You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/09/15 19:25:33 UTC
[01/50] [abbrv] ignite git commit: Minor.
Repository: ignite
Updated Branches:
refs/heads/ignite-1093-2 fdfa62f0f -> 25db29bcb
Minor.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b4c515e6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b4c515e6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b4c515e6
Branch: refs/heads/ignite-1093-2
Commit: b4c515e62bc8412a2859a5a771ef3c4b38691529
Parents: 095d4b3
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 14 11:37:36 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 14 11:37:36 2015 +0300
----------------------------------------------------------------------
.../dht/GridCacheTxNodeFailureSelfTest.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b4c515e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
index 1135c40..dc78003 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -36,8 +36,10 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
@@ -59,6 +61,9 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
*/
@SuppressWarnings("unchecked")
public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
/**
* @return Grid count.
*/
@@ -70,6 +75,8 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
cfg.setCacheConfiguration(cacheConfiguration(gridName));
cfg.setCommunicationSpi(new BanningCommunicationSpi());
@@ -202,9 +209,8 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
final CountDownLatch commitLatch = new CountDownLatch(1);
- if (!commit) {
+ if (!commit)
communication(1).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareRequest.class));
- }
else {
if (!backup) {
communication(2).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareResponse.class));
@@ -389,12 +395,11 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) {
GridIoMessage ioMsg = (GridIoMessage)msg;
- if (!bannedClasses.contains(ioMsg.message().getClass())) {
- super.sendMessage(node, msg, ackClosure);
- }
+ if (!bannedClasses.contains(ioMsg.message().getClass()))
+ super.sendMessage(node, msg, ackC);
}
}
}
[11/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
new file mode 100644
index 0000000..de0df8d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
@@ -0,0 +1,358 @@
+/*
+ * 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.api;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.portable.GridPortableMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.marshaller.AbstractMarshaller;
+import org.apache.ignite.marshaller.MarshallerContext;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableProtocolVersion;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
+ * in the portable format.
+ * <p>
+ * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
+ * <p>
+ * <h1 class="header">Configuration</h1>
+ * <h2 class="header">Mandatory</h2>
+ * This marshaller has no mandatory configuration parameters.
+ * <h2 class="header">Java Example</h2>
+ * <pre name="code" class="java">
+ * PortableMarshaller marshaller = new PortableMarshaller();
+ *
+ * IgniteConfiguration cfg = new IgniteConfiguration();
+ *
+ * // Override marshaller.
+ * cfg.setMarshaller(marshaller);
+ *
+ * // Starts grid.
+ * G.start(cfg);
+ * </pre>
+ * <h2 class="header">Spring Example</h2>
+ * PortableMarshaller can be configured from Spring XML configuration file:
+ * <pre name="code" class="xml">
+ * <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true">
+ * ...
+ * <property name="marshaller">
+ * <bean class="org.apache.ignite.internal.portable.api.PortableMarshaller">
+ * ...
+ * </bean>
+ * </property>
+ * ...
+ * </bean>
+ * </pre>
+ * <p>
+ * <img src="http://ignite.apache.org/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ */
+public class PortableMarshaller extends AbstractMarshaller {
+ /** Default portable protocol version. */
+ public static final PortableProtocolVersion DFLT_PORTABLE_PROTO_VER = PortableProtocolVersion.VER_1_4_0;
+
+ /** Class names. */
+ private Collection<String> clsNames;
+
+ /** ID mapper. */
+ private PortableIdMapper idMapper;
+
+ /** Serializer. */
+ private PortableSerializer serializer;
+
+ /** Types. */
+ private Collection<PortableTypeConfiguration> typeCfgs;
+
+ /** Use timestamp flag. */
+ private boolean useTs = true;
+
+ /** Whether to convert string to bytes using UTF-8 encoding. */
+ private boolean convertString = true;
+
+ /** Meta data enabled flag. */
+ private boolean metaDataEnabled = true;
+
+ /** Keep deserialized flag. */
+ private boolean keepDeserialized = true;
+
+ /** Protocol version. */
+ private PortableProtocolVersion protoVer = DFLT_PORTABLE_PROTO_VER;
+
+ /** */
+ private GridPortableMarshaller impl;
+
+ /**
+ * Gets class names.
+ *
+ * @return Class names.
+ */
+ public Collection<String> getClassNames() {
+ return clsNames;
+ }
+
+ /**
+ * Sets class names of portable objects explicitly.
+ *
+ * @param clsNames Class names.
+ */
+ public void setClassNames(Collection<String> clsNames) {
+ this.clsNames = new ArrayList<>(clsNames.size());
+
+ for (String clsName : clsNames)
+ this.clsNames.add(clsName.trim());
+ }
+
+ /**
+ * Gets ID mapper.
+ *
+ * @return ID mapper.
+ */
+ public PortableIdMapper getIdMapper() {
+ return idMapper;
+ }
+
+ /**
+ * Sets ID mapper.
+ *
+ * @param idMapper ID mapper.
+ */
+ public void setIdMapper(PortableIdMapper idMapper) {
+ this.idMapper = idMapper;
+ }
+
+ /**
+ * Gets serializer.
+ *
+ * @return Serializer.
+ */
+ public PortableSerializer getSerializer() {
+ return serializer;
+ }
+
+ /**
+ * Sets serializer.
+ *
+ * @param serializer Serializer.
+ */
+ public void setSerializer(PortableSerializer serializer) {
+ this.serializer = serializer;
+ }
+
+ /**
+ * Gets types configuration.
+ *
+ * @return Types configuration.
+ */
+ public Collection<PortableTypeConfiguration> getTypeConfigurations() {
+ return typeCfgs;
+ }
+
+ /**
+ * Sets type configurations.
+ *
+ * @param typeCfgs Type configurations.
+ */
+ public void setTypeConfigurations(Collection<PortableTypeConfiguration> typeCfgs) {
+ this.typeCfgs = typeCfgs;
+ }
+
+ /**
+ * If {@code true} then date values converted to {@link Timestamp} on deserialization.
+ * <p>
+ * Default value is {@code true}.
+ *
+ * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public boolean isUseTimestamp() {
+ return useTs;
+ }
+
+ /**
+ * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public void setUseTimestamp(boolean useTs) {
+ this.useTs = useTs;
+ }
+
+ /**
+ * Gets strings must be converted to or from bytes using UTF-8 encoding.
+ * <p>
+ * Default value is {@code true}.
+ *
+ * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
+ */
+ public boolean isConvertStringToBytes() {
+ return convertString;
+ }
+
+ /**
+ * Sets strings must be converted to or from bytes using UTF-8 encoding.
+ * <p>
+ * Default value is {@code true}.
+ *
+ * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
+ */
+ public void setConvertStringToBytes(boolean convertString) {
+ this.convertString = convertString;
+ }
+
+ /**
+ * If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
+ * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
+ * <p>
+ * Default value if {@code true}.
+ *
+ * @return Whether meta data is collected.
+ */
+ public boolean isMetaDataEnabled() {
+ return metaDataEnabled;
+ }
+
+ /**
+ * @param metaDataEnabled Whether meta data is collected.
+ */
+ public void setMetaDataEnabled(boolean metaDataEnabled) {
+ this.metaDataEnabled = metaDataEnabled;
+ }
+
+ /**
+ * If {@code true}, {@link PortableObject} will cache deserialized instance after
+ * {@link PortableObject#deserialize()} is called. All consequent calls of this
+ * method on the same instance of {@link PortableObject} will return that cached
+ * value without actually deserializing portable object. If you need to override this
+ * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
+ * method.
+ * <p>
+ * Default value if {@code true}.
+ *
+ * @return Whether deserialized value is kept.
+ */
+ public boolean isKeepDeserialized() {
+ return keepDeserialized;
+ }
+
+ /**
+ * @param keepDeserialized Whether deserialized value is kept.
+ */
+ public void setKeepDeserialized(boolean keepDeserialized) {
+ this.keepDeserialized = keepDeserialized;
+ }
+
+ /**
+ * Gets portable protocol version.
+ * <p>
+ * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
+ *
+ * @return Portable protocol version.
+ */
+ public PortableProtocolVersion getProtocolVersion() {
+ return protoVer;
+ }
+
+ /**
+ * Sets portable protocol version.
+ * <p>
+ * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
+ *
+ * @param protoVer Portable protocol version.
+ */
+ public void setProtocolVersion(PortableProtocolVersion protoVer) {
+ if (protoVer == null)
+ throw new IllegalArgumentException("Wrong portable protocol version: " + protoVer);
+
+ this.protoVer = protoVer;
+ }
+
+ /**
+ * Returns currently set {@link MarshallerContext}.
+ *
+ * @return Marshaller context.
+ */
+ public MarshallerContext getContext() {
+ return ctx;
+ }
+
+ /**
+ * Sets {@link PortableContext}.
+ * <p/>
+ * @param ctx Portable context.
+ */
+ private void setPortableContext(PortableContext ctx) {
+ ctx.configure(this);
+
+ impl = new GridPortableMarshaller(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
+ return impl.marshal(obj, 0);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+ byte[] arr = marshal(obj);
+
+ try {
+ out.write(arr);
+ }
+ catch (IOException e) {
+ throw new PortableException("Failed to marshal the object: " + obj, e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+ return impl.deserialize(bytes, clsLdr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+ byte[] arr = new byte[4096];
+ int cnt;
+
+ // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that
+ // returns number of bytes remaining.
+ try {
+ while ((cnt = in.read(arr)) != -1)
+ buffer.write(arr, 0, cnt);
+
+ buffer.flush();
+
+ return impl.deserialize(buffer.toByteArray(), clsLdr);
+ }
+ catch (IOException e) {
+ throw new PortableException("Failed to unmarshal the object from InputStream", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
new file mode 100644
index 0000000..a90bdca
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
@@ -0,0 +1,60 @@
+/*
+ * 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.api;
+
+import java.util.Collection;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable type meta data. Metadata for portable types can be accessed from any of the
+ * {@link IgnitePortables#metadata(String)} methods.
+ * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ */
+public interface PortableMetadata {
+ /**
+ * Gets portable type name.
+ *
+ * @return Portable type name.
+ */
+ public String typeName();
+
+ /**
+ * Gets collection of all field names for this portable type.
+ *
+ * @return Collection of all field names for this portable type.
+ */
+ public Collection<String> fields();
+
+ /**
+ * Gets name of the field type for a given field.
+ *
+ * @param fieldName Field name.
+ * @return Field type name.
+ */
+ @Nullable public String fieldTypeName(String fieldName);
+
+ /**
+ * Portable objects can optionally specify custom key-affinity mapping in the
+ * configuration. This method returns the name of the field which should be
+ * used for the key-affinity mapping.
+ *
+ * @return Affinity key field name.
+ */
+ @Nullable public String affinityKeyFieldName();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
new file mode 100644
index 0000000..ec965c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
@@ -0,0 +1,152 @@
+/*
+ * 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.api;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Wrapper for portable object in portable binary format. Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ * <p>
+ * <b>NOTE:</b> user does not need to (and should not) implement this interface directly.
+ * <p>
+ * To work with the portable format directly, user should create a cache projection
+ * over {@code PortableObject} class and then retrieve individual fields as needed:
+ * <pre name=code class=java>
+ * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use GridPortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.portables().toPortable(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ * </pre>
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ * <pre name=code class=java>
+ * IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null);
+ *
+ * MyValue val = cache.get(new MyKey());
+ *
+ * // Normal java getter.
+ * String fieldVal = val.getMyFieldName();
+ * </pre>
+ * <h1 class="header">Working With Maps and Collections</h1>
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ * <h1 class="header">Dynamic Structure Changes</h1>
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ * <h1 class="header">Building Portable Objects</h1>
+ * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
+ *
+ * builder.setField("fieldA", "A");
+ * builder.setField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ * <pre name=code class=java>
+ * MyObject obj = new MyObject();
+ *
+ * obj.setFieldA("A");
+ * obj.setFieldB(123);
+ *
+ * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
+ * </pre>
+ * <h1 class="header">Portable Metadata</h1>
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ */
+public interface PortableObject extends Serializable, Cloneable {
+ /**
+ * Gets portable object type ID.
+ *
+ * @return Type ID.
+ */
+ public int typeId();
+
+ /**
+ * Gets meta data for this portable object.
+ *
+ * @return Meta data.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metaData() throws PortableException;
+
+ /**
+ * Gets field value.
+ *
+ * @param fieldName Field name.
+ * @return Field value.
+ * @throws PortableException In case of any other error.
+ */
+ @Nullable public <F> F field(String fieldName) throws PortableException;
+
+ /**
+ * Checks whether field is set.
+ *
+ * @param fieldName Field name.
+ * @return {@code true} if field is set.
+ */
+ public boolean hasField(String fieldName);
+
+ /**
+ * Gets fully deserialized instance of portable object.
+ *
+ * @return Fully deserialized instance of portable object.
+ * @throws PortableInvalidClassException If class doesn't exist.
+ * @throws PortableException In case of any other error.
+ */
+ @Nullable public <T> T deserialize() throws PortableException;
+
+ /**
+ * Copies this portable object.
+ *
+ * @return Copy of this portable object.
+ */
+ public PortableObject clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
new file mode 100644
index 0000000..741c2a5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
@@ -0,0 +1,41 @@
+/*
+ * 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.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable protocol version.
+ */
+public enum PortableProtocolVersion {
+ /** Ignite 1.4.0 release. */
+ VER_1_4_0;
+
+ /** Enumerated values. */
+ private static final PortableProtocolVersion[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static PortableProtocolVersion fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
new file mode 100644
index 0000000..c12aa1a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
@@ -0,0 +1,234 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Raw reader for portable objects. Raw reader does not use field name hash codes, therefore,
+ * making the format even more compact. However, if the raw reader is used,
+ * dynamic structure changes to the portable objects are not supported.
+ */
+public interface PortableRawReader {
+ /**
+ * @return Byte value.
+ * @throws PortableException In case of error.
+ */
+ public byte readByte() throws PortableException;
+
+ /**
+ * @return Short value.
+ * @throws PortableException In case of error.
+ */
+ public short readShort() throws PortableException;
+
+ /**
+ * @return Integer value.
+ * @throws PortableException In case of error.
+ */
+ public int readInt() throws PortableException;
+
+ /**
+ * @return Long value.
+ * @throws PortableException In case of error.
+ */
+ public long readLong() throws PortableException;
+
+ /**
+ * @return Float value.
+ * @throws PortableException In case of error.
+ */
+ public float readFloat() throws PortableException;
+
+ /**
+ * @return Double value.
+ * @throws PortableException In case of error.
+ */
+ public double readDouble() throws PortableException;
+
+ /**
+ * @return Char value.
+ * @throws PortableException In case of error.
+ */
+ public char readChar() throws PortableException;
+
+ /**
+ * @return Boolean value.
+ * @throws PortableException In case of error.
+ */
+ public boolean readBoolean() throws PortableException;
+
+ /**
+ * @return Decimal value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal readDecimal() throws PortableException;
+
+ /**
+ * @return String value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String readString() throws PortableException;
+
+ /**
+ * @return UUID.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID readUuid() throws PortableException;
+
+ /**
+ * @return Date.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date readDate() throws PortableException;
+
+ /**
+ * @return Timestamp.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Timestamp readTimestamp() throws PortableException;
+
+ /**
+ * @return Object.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T> T readObject() throws PortableException;
+
+ /**
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public byte[] readByteArray() throws PortableException;
+
+ /**
+ * @return Short array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public short[] readShortArray() throws PortableException;
+
+ /**
+ * @return Integer array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public int[] readIntArray() throws PortableException;
+
+ /**
+ * @return Long array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public long[] readLongArray() throws PortableException;
+
+ /**
+ * @return Float array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public float[] readFloatArray() throws PortableException;
+
+ /**
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public double[] readDoubleArray() throws PortableException;
+
+ /**
+ * @return Char array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public char[] readCharArray() throws PortableException;
+
+ /**
+ * @return Boolean array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public boolean[] readBooleanArray() throws PortableException;
+
+ /**
+ * @return Decimal array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
+
+ /**
+ * @return String array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String[] readStringArray() throws PortableException;
+
+ /**
+ * @return UUID array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID[] readUuidArray() throws PortableException;
+
+ /**
+ * @return Date array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date[] readDateArray() throws PortableException;
+
+ /**
+ * @return Object array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Object[] readObjectArray() throws PortableException;
+
+ /**
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T> Collection<T> readCollection() throws PortableException;
+
+ /**
+ * @param colCls Collection class.
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T> Collection<T> readCollection(Class<? extends Collection<T>> colCls)
+ throws PortableException;
+
+ /**
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <K, V> Map<K, V> readMap() throws PortableException;
+
+ /**
+ * @param mapCls Map class.
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <K, V> Map<K, V> readMap(Class<? extends Map<K, V>> mapCls) throws PortableException;
+
+ /**
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T extends Enum<?>> T readEnum() throws PortableException;
+
+ /**
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T extends Enum<?>> T[] readEnumArray() throws PortableException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
new file mode 100644
index 0000000..91f0e3b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
@@ -0,0 +1,219 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Raw writer for portable object. Raw writer does not write field name hash codes, therefore,
+ * making the format even more compact. However, if the raw writer is used,
+ * dynamic structure changes to the portable objects are not supported.
+ */
+public interface PortableRawWriter {
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByte(byte val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShort(short val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeInt(int val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLong(long val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloat(float val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDouble(double val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeChar(char val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBoolean(boolean val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeString(@Nullable String val) throws PortableException;
+
+ /**
+ * @param val UUID to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuid(@Nullable UUID val) throws PortableException;
+
+ /**
+ * @param val Date to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDate(@Nullable Date val) throws PortableException;
+
+ /**
+ * @param val Timestamp to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeTimestamp(@Nullable Timestamp val) throws PortableException;
+
+ /**
+ * @param obj Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObject(@Nullable Object obj) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByteArray(@Nullable byte[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShortArray(@Nullable short[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeIntArray(@Nullable int[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLongArray(@Nullable long[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloatArray(@Nullable float[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDoubleArray(@Nullable double[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeCharArray(@Nullable char[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBooleanArray(@Nullable boolean[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeStringArray(@Nullable String[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuidArray(@Nullable UUID[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDateArray(@Nullable Date[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObjectArray(@Nullable Object[] val) throws PortableException;
+
+ /**
+ * @param col Collection to write.
+ * @throws PortableException In case of error.
+ */
+ public <T> void writeCollection(@Nullable Collection<T> col) throws PortableException;
+
+ /**
+ * @param map Map to write.
+ * @throws PortableException In case of error.
+ */
+ public <K, V> void writeMap(@Nullable Map<K, V> map) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public <T extends Enum<?>> void writeEnum(T val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public <T extends Enum<?>> void writeEnumArray(T[] val) throws PortableException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
new file mode 100644
index 0000000..ca322e7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
@@ -0,0 +1,284 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Reader for portable objects used in {@link PortableMarshalAware} implementations.
+ * Useful for the cases when user wants a fine-grained control over serialization.
+ * <p>
+ * Note that Ignite never writes full strings for field or type names. Instead,
+ * for performance reasons, Ignite writes integer hash codes for type and field names.
+ * It has been tested that hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide, Ignite provides {@link PortableIdMapper} which
+ * allows to override the automatically generated hash code IDs for the type and field names.
+ */
+public interface PortableReader {
+ /**
+ * @param fieldName Field name.
+ * @return Byte value.
+ * @throws PortableException In case of error.
+ */
+ public byte readByte(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Short value.
+ * @throws PortableException In case of error.
+ */
+ public short readShort(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Integer value.
+ * @throws PortableException In case of error.
+ */
+ public int readInt(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Long value.
+ * @throws PortableException In case of error.
+ */
+ public long readLong(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @throws PortableException In case of error.
+ * @return Float value.
+ */
+ public float readFloat(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Double value.
+ * @throws PortableException In case of error.
+ */
+ public double readDouble(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Char value.
+ * @throws PortableException In case of error.
+ */
+ public char readChar(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Boolean value.
+ * @throws PortableException In case of error.
+ */
+ public boolean readBoolean(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Decimal value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return String value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String readString(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return UUID.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID readUuid(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Date.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date readDate(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Timestamp.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Timestamp readTimestamp(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Object.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T> T readObject(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public byte[] readByteArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Short array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public short[] readShortArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Integer array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public int[] readIntArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Long array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public long[] readLongArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Float array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public float[] readFloatArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public double[] readDoubleArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Char array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public char[] readCharArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Boolean array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public boolean[] readBooleanArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Decimal array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return String array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String[] readStringArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return UUID array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID[] readUuidArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Date array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date[] readDateArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Object array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Object[] readObjectArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T> Collection<T> readCollection(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param colCls Collection class.
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T> Collection<T> readCollection(String fieldName, Class<? extends Collection<T>> colCls)
+ throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <K, V> Map<K, V> readMap(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param mapCls Map class.
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <K, V> Map<K, V> readMap(String fieldName, Class<? extends Map<K, V>> mapCls)
+ throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T extends Enum<?>> T readEnum(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public <T extends Enum<?>> T[] readEnumArray(String fieldName) throws PortableException;
+
+ /**
+ * Gets raw reader. Raw reader does not use field name hash codes, therefore,
+ * making the format even more compact. However, if the raw reader is used,
+ * dynamic structure changes to the portable objects are not supported.
+ *
+ * @return Raw reader.
+ */
+ public PortableRawReader rawReader();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
new file mode 100644
index 0000000..b9e835f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
@@ -0,0 +1,47 @@
+/*
+ * 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.api;
+
+/**
+ * Interface that allows to implement custom serialization logic for portable objects.
+ * Can be used instead of {@link PortableMarshalAware} in case if the class
+ * cannot be changed directly.
+ * <p>
+ * Portable serializer can be configured for all portable objects via
+ * {@link PortableMarshaller#getSerializer()} method, or for a specific
+ * portable type via {@link PortableTypeConfiguration#getSerializer()} method.
+ */
+public interface PortableSerializer {
+ /**
+ * Writes fields to provided writer.
+ *
+ * @param obj Empty object.
+ * @param writer Portable object writer.
+ * @throws PortableException In case of error.
+ */
+ public void writePortable(Object obj, PortableWriter writer) throws PortableException;
+
+ /**
+ * Reads fields from provided reader.
+ *
+ * @param obj Empty object
+ * @param reader Portable object reader.
+ * @throws PortableException In case of error.
+ */
+ public void readPortable(Object obj, PortableReader reader) throws PortableException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
new file mode 100644
index 0000000..80a043e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
@@ -0,0 +1,195 @@
+/*
+ * 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.api;
+
+import java.sql.Timestamp;
+import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Defines configuration properties for a specific portable type. Providing per-type
+ * configuration is optional, as it is generally enough, and also optional, to provide global portable
+ * configuration using {@link PortableMarshaller#setClassNames(Collection)}.
+ * However, this class allows you to change configuration properties for a specific
+ * portable type without affecting configuration for other portable types.
+ * <p>
+ * Per-type portable configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method.
+ */
+public class PortableTypeConfiguration {
+ /** Class name. */
+ private String clsName;
+
+ /** ID mapper. */
+ private PortableIdMapper idMapper;
+
+ /** Serializer. */
+ private PortableSerializer serializer;
+
+ /** Use timestamp flag. */
+ private Boolean useTs;
+
+ /** Meta data enabled flag. */
+ private Boolean metaDataEnabled;
+
+ /** Keep deserialized flag. */
+ private Boolean keepDeserialized;
+
+ /** Affinity key field name. */
+ private String affKeyFieldName;
+
+ /**
+ */
+ public PortableTypeConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * @param clsName Class name.
+ */
+ public PortableTypeConfiguration(String clsName) {
+ this.clsName = clsName;
+ }
+
+ /**
+ * Gets type name.
+ *
+ * @return Type name.
+ */
+ public String getClassName() {
+ return clsName;
+ }
+
+ /**
+ * Sets type name.
+ *
+ * @param clsName Type name.
+ */
+ public void setClassName(String clsName) {
+ this.clsName = clsName;
+ }
+
+ /**
+ * Gets ID mapper.
+ *
+ * @return ID mapper.
+ */
+ public PortableIdMapper getIdMapper() {
+ return idMapper;
+ }
+
+ /**
+ * Sets ID mapper.
+ *
+ * @param idMapper ID mapper.
+ */
+ public void setIdMapper(PortableIdMapper idMapper) {
+ this.idMapper = idMapper;
+ }
+
+ /**
+ * Gets serializer.
+ *
+ * @return Serializer.
+ */
+ public PortableSerializer getSerializer() {
+ return serializer;
+ }
+
+ /**
+ * Sets serializer.
+ *
+ * @param serializer Serializer.
+ */
+ public void setSerializer(PortableSerializer serializer) {
+ this.serializer = serializer;
+ }
+
+ /**
+ * If {@code true} then date values converted to {@link Timestamp} during unmarshalling.
+ *
+ * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public Boolean isUseTimestamp() {
+ return useTs;
+ }
+
+ /**
+ * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public void setUseTimestamp(Boolean useTs) {
+ this.useTs = useTs;
+ }
+
+ /**
+ * Defines whether meta data is collected for this type. If provided, this value will override
+ * {@link PortableMarshaller#isMetaDataEnabled()} property.
+ *
+ * @return Whether meta data is collected.
+ */
+ public Boolean isMetaDataEnabled() {
+ return metaDataEnabled;
+ }
+
+ /**
+ * @param metaDataEnabled Whether meta data is collected.
+ */
+ public void setMetaDataEnabled(Boolean metaDataEnabled) {
+ this.metaDataEnabled = metaDataEnabled;
+ }
+
+ /**
+ * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
+ * this value will override {@link PortableMarshaller#isKeepDeserialized()}
+ * property.
+ *
+ * @return Whether deserialized value is kept.
+ */
+ public Boolean isKeepDeserialized() {
+ return keepDeserialized;
+ }
+
+ /**
+ * @param keepDeserialized Whether deserialized value is kept.
+ */
+ public void setKeepDeserialized(Boolean keepDeserialized) {
+ this.keepDeserialized = keepDeserialized;
+ }
+
+ /**
+ * Gets affinity key field name.
+ *
+ * @return Affinity key field name.
+ */
+ public String getAffinityKeyFieldName() {
+ return affKeyFieldName;
+ }
+
+ /**
+ * Sets affinity key field name.
+ *
+ * @param affKeyFieldName Affinity key field name.
+ */
+ public void setAffinityKeyFieldName(String affKeyFieldName) {
+ this.affKeyFieldName = affKeyFieldName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PortableTypeConfiguration.class, this, super.toString());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
new file mode 100644
index 0000000..8af04a3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
@@ -0,0 +1,266 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Writer for portable object used in {@link PortableMarshalAware} implementations.
+ * Useful for the cases when user wants a fine-grained control over serialization.
+ * <p>
+ * Note that Ignite never writes full strings for field or type names. Instead,
+ * for performance reasons, Ignite writes integer hash codes for type and field names.
+ * It has been tested that hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide, Ignite provides {@link PortableIdMapper} which
+ * allows to override the automatically generated hash code IDs for the type and field names.
+ */
+public interface PortableWriter {
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByte(String fieldName, byte val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShort(String fieldName, short val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeInt(String fieldName, int val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLong(String fieldName, long val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloat(String fieldName, float val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDouble(String fieldName, double val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeChar(String fieldName, char val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBoolean(String fieldName, boolean val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeString(String fieldName, @Nullable String val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val UUID to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Date to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDate(String fieldName, @Nullable Date val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Timestamp to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param obj Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObject(String fieldName, @Nullable Object obj) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param col Collection to write.
+ * @throws PortableException In case of error.
+ */
+ public <T> void writeCollection(String fieldName, @Nullable Collection<T> col) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param map Map to write.
+ * @throws PortableException In case of error.
+ */
+ public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws PortableException;
+
+ /**
+ * Gets raw writer. Raw writer does not write field name hash codes, therefore,
+ * making the format even more compact. However, if the raw writer is used,
+ * dynamic structure changes to the portable objects are not supported.
+ *
+ * @return Raw writer.
+ */
+ public PortableRawWriter rawWriter();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
index 1472d56..8673b70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
index b2e4c0d..96d10a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
@@ -25,17 +25,13 @@ import java.util.Set;
import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
import org.apache.ignite.internal.util.GridArgumentCheck;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import org.apache.ignite.internal.portable.*;
-import org.apache.ignite.internal.processors.cache.portable.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.portable.*;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLS_NAME_POS;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.DFLT_HDR_LEN;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
index 45355d7..e93f860 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.portable.PortablePrimitives;
import org.apache.ignite.internal.portable.PortableReaderExImpl;
import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
index 2d9c961..6fe8875 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
@@ -21,8 +21,8 @@ import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableObjectEx;
import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.apache.ignite.internal.util.*;
-import org.apache.ignite.portable.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
index d864a6e..15c52e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
@@ -20,8 +20,8 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
index 1126a3c..96f4944 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
index 8743fbe..300c4ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.PortableObjectImpl;
import org.apache.ignite.internal.portable.PortableObjectOffheapImpl;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
index 107b02e..80f91be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.portable.streams;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
/**
* Portable abstract input stream.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 75d4c43..59bb5f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -115,7 +115,7 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.jetbrains.annotations.Nullable;
@@ -1063,12 +1063,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheConfiguration cfg = cacheCtx.config();
- // Intentionally compare Boolean references using '!=' below to check if the flag has been explicitly set.
- if (cfg.isKeepPortableInStore() && cfg.isKeepPortableInStore() != CacheConfiguration.DFLT_KEEP_PORTABLE_IN_STORE
- && !(ctx.config().getMarshaller() instanceof PortableMarshaller))
- U.warn(log, "CacheConfiguration.isKeepPortableInStore() configuration property will be ignored because " +
- "PortableMarshaller is not used");
-
// Start managers.
for (GridCacheManager mgr : F.view(cacheCtx.managers(), F.notContains(dhtExcludes(cacheCtx))))
mgr.start(cacheCtx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index ce0cdd7..cc6c19a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -311,11 +311,6 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
- @Override public <K1, V1> IgniteCache<K1, V1> withKeepPortable() {
- return keepPortable();
- }
-
- /** {@inheritDoc} */
@Override public IgniteCache<K, V> withNoRetries() {
GridCacheGateway<K, V> gate = this.gate;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
index 23edd9e..0dbf71d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
@@ -21,7 +21,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
index 2e0d37d..d064601 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
index fcd73d2..7f6512b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
@@ -20,11 +20,11 @@ package org.apache.ignite.internal.processors.cache.portable;
import java.util.Collection;
import java.util.Map;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
index 1be5aea..4cab3db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
@@ -39,7 +39,7 @@ import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -80,11 +80,11 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import sun.misc.Unsafe;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
index 5ed6505..40c3b70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
@@ -18,13 +18,13 @@
package org.apache.ignite.internal.processors.cache.portable;
import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
[05/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java
deleted file mode 100644
index 9ba38d9..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java
+++ /dev/null
@@ -1,190 +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.processors.cache.portable;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-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;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
-
-/**
- * Test for portable objects stored in cache.
- */
-public abstract class GridCachePortableObjectsAbstractDataStreamerSelfTest extends GridCommonAbstractTest {
- /** */
- private static final int THREAD_CNT = 64;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- CacheConfiguration cacheCfg = new CacheConfiguration();
-
- cacheCfg.setCacheMode(cacheMode());
- cacheCfg.setAtomicityMode(atomicityMode());
- cacheCfg.setNearConfiguration(nearConfiguration());
- cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
-
- cfg.setCacheConfiguration(cacheCfg);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(TestObject.class.getName())));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /**
- * @return Sync mode.
- */
- protected CacheWriteSynchronizationMode writeSynchronizationMode() {
- return PRIMARY_SYNC;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(gridCount());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @return Cache mode.
- */
- protected abstract CacheMode cacheMode();
-
- /**
- * @return Atomicity mode.
- */
- protected abstract CacheAtomicityMode atomicityMode();
-
- /**
- * @return Near configuration.
- */
- protected abstract NearCacheConfiguration nearConfiguration();
-
- /**
- * @return Grid count.
- */
- protected int gridCount() {
- return 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("BusyWait")
- public void testGetPut() throws Exception {
- final AtomicBoolean flag = new AtomicBoolean();
-
- final LongAdder8 cnt = new LongAdder8();
-
- try (IgniteDataStreamer<Object, Object> ldr = grid(0).dataStreamer(null)) {
- IgniteInternalFuture<?> f = multithreadedAsync(
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- while (!flag.get()) {
- ldr.addData(rnd.nextInt(10000), new TestObject(rnd.nextInt(10000)));
-
- cnt.add(1);
- }
-
- return null;
- }
- },
- THREAD_CNT
- );
-
- for (int i = 0; i < 30 && !f.isDone(); i++)
- Thread.sleep(1000);
-
- flag.set(true);
-
- f.get();
- }
-
- info("Operations in 30 sec: " + cnt.sum());
- }
-
- /**
- */
- private static class TestObject implements PortableMarshalAware, Serializable {
- /** */
- private int val;
-
- /**
- */
- private TestObject() {
- // No-op.
- }
-
- /**
- * @param val Value.
- */
- private TestObject(int val) {
- this.val = val;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return obj instanceof TestObject && ((TestObject)obj).val == val;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeInt("val", val);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- val = reader.readInt("val");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java
deleted file mode 100644
index 67f0e52..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java
+++ /dev/null
@@ -1,231 +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.processors.cache.portable;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableObject;
-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;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
-
-/**
- * Test for portable objects stored in cache.
- */
-public abstract class GridCachePortableObjectsAbstractMultiThreadedSelfTest extends GridCommonAbstractTest {
- /** */
- private static final int THREAD_CNT = 64;
-
- /** */
- private static final AtomicInteger idxGen = new AtomicInteger();
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- CacheConfiguration cacheCfg = new CacheConfiguration();
-
- cacheCfg.setCacheMode(cacheMode());
- cacheCfg.setAtomicityMode(atomicityMode());
- cacheCfg.setNearConfiguration(nearConfiguration());
- cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
-
- cfg.setCacheConfiguration(cacheCfg);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(TestObject.class.getName())));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /**
- * @return Sync mode.
- */
- protected CacheWriteSynchronizationMode writeSynchronizationMode() {
- return PRIMARY_SYNC;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(gridCount());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @return Cache mode.
- */
- protected abstract CacheMode cacheMode();
-
- /**
- * @return Atomicity mode.
- */
- protected abstract CacheAtomicityMode atomicityMode();
-
- /**
- * @return Distribution mode.
- */
- protected abstract NearCacheConfiguration nearConfiguration();
-
- /**
- * @return Grid count.
- */
- protected int gridCount() {
- return 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("BusyWait") public void testGetPut() throws Exception {
- final AtomicBoolean flag = new AtomicBoolean();
-
- final LongAdder8 cnt = new LongAdder8();
-
- IgniteInternalFuture<?> f = multithreadedAsync(
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- int threadId = idxGen.getAndIncrement() % 2;
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- while (!flag.get()) {
- IgniteCache<Object, Object> c = jcache(rnd.nextInt(gridCount()));
-
- switch (threadId) {
- case 0:
- // Put/get/remove portable -> portable.
-
- c.put(new TestObject(rnd.nextInt(10000)), new TestObject(rnd.nextInt(10000)));
-
- IgniteCache<Object, Object> p2 = ((IgniteCacheProxy<Object, Object>)c).keepPortable();
-
- PortableObject v = (PortableObject)p2.get(new TestObject(rnd.nextInt(10000)));
-
- if (v != null)
- v.deserialize();
-
- c.remove(new TestObject(rnd.nextInt(10000)));
-
- break;
-
- case 1:
- // Put/get int -> portable.
- c.put(rnd.nextInt(10000), new TestObject(rnd.nextInt(10000)));
-
- IgniteCache<Integer, PortableObject> p4 = ((IgniteCacheProxy<Object, Object>)c).keepPortable();
-
- PortableObject v1 = p4.get(rnd.nextInt(10000));
-
- if (v1 != null)
- v1.deserialize();
-
- p4.remove(rnd.nextInt(10000));
-
- break;
-
- default:
- assert false;
- }
-
- cnt.add(3);
- }
-
- return null;
- }
- },
- THREAD_CNT
- );
-
- for (int i = 0; i < 30 && !f.isDone(); i++)
- Thread.sleep(1000);
-
- flag.set(true);
-
- f.get();
-
- info("Operations in 30 sec: " + cnt.sum());
- }
-
- /**
- */
- private static class TestObject implements PortableMarshalAware, Serializable {
- /** */
- private int val;
-
- /**
- */
- private TestObject() {
- // No-op.
- }
-
- /**
- * @param val Value.
- */
- private TestObject(int val) {
- this.val = val;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return obj instanceof TestObject && ((TestObject)obj).val == val;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeInt("val", val);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- val = reader.readInt("val");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java
deleted file mode 100644
index 7ac8712..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java
+++ /dev/null
@@ -1,978 +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.processors.cache.portable;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import javax.cache.Cache;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.MutableEntry;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.portable.PortableObjectImpl;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.internal.util.typedef.P2;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiInClosure;
-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.PortableObject;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-
-/**
- * Test for portable objects stored in cache.
- */
-public abstract class GridCachePortableObjectsAbstractSelfTest extends GridCommonAbstractTest {
- /** */
- public static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final int ENTRY_CNT = 100;
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(disco);
-
- CacheConfiguration cacheCfg = new CacheConfiguration();
-
- cacheCfg.setCacheMode(cacheMode());
- cacheCfg.setAtomicityMode(atomicityMode());
- cacheCfg.setNearConfiguration(nearConfiguration());
- cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
- cacheCfg.setCacheStoreFactory(singletonFactory(new TestStore()));
- cacheCfg.setReadThrough(true);
- cacheCfg.setWriteThrough(true);
- cacheCfg.setLoadPreviousValue(true);
- cacheCfg.setBackups(1);
-
- if (offheapTiered()) {
- cacheCfg.setMemoryMode(OFFHEAP_TIERED);
- cacheCfg.setOffHeapMaxMemory(0);
- }
-
- cfg.setCacheConfiguration(cacheCfg);
-
- cfg.setMarshaller(new PortableMarshaller());
-
- return cfg;
- }
-
- /**
- * @return {@code True} if should use OFFHEAP_TIERED mode.
- */
- protected boolean offheapTiered() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(gridCount());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- for (int i = 0; i < gridCount(); i++) {
- GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache();
-
- for (GridCacheEntryEx e : c.map().entries0()) {
- Object key = e.key().value(c.context().cacheObjectContext(), false);
- Object val = CU.value(e.rawGet(), c.context(), false);
-
- if (key instanceof PortableObject)
- assert ((PortableObjectImpl)key).detached() : val;
-
- if (val instanceof PortableObject)
- assert ((PortableObjectImpl)val).detached() : val;
- }
- }
-
- IgniteCache<Object, Object> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.remove(i);
-
- if (offheapTiered()) {
- for (int k = 0; k < 100; k++)
- c.remove(k);
- }
-
- assertEquals(0, c.size());
- }
-
- /**
- * @return Cache mode.
- */
- protected abstract CacheMode cacheMode();
-
- /**
- * @return Atomicity mode.
- */
- protected abstract CacheAtomicityMode atomicityMode();
-
- /**
- * @return Distribution mode.
- */
- protected abstract NearCacheConfiguration nearConfiguration();
-
- /**
- * @return Grid count.
- */
- protected abstract int gridCount();
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("unchecked")
- public void testCircularReference() throws Exception {
- IgniteCache c = keepPortableCache();
-
- TestReferenceObject obj1 = new TestReferenceObject();
-
- obj1.obj = new TestReferenceObject(obj1);
-
- c.put(1, obj1);
-
- PortableObject po = (PortableObject)c.get(1);
-
- String str = po.toString();
-
- log.info("toString: " + str);
-
- assertNotNull(str);
-
- assertTrue("Unexpected toString: " + str,
- str.startsWith("TestReferenceObject") && str.contains("obj=TestReferenceObject ["));
-
- TestReferenceObject obj1_r = po.deserialize();
-
- assertNotNull(obj1_r);
-
- TestReferenceObject obj2_r = obj1_r.obj;
-
- assertNotNull(obj2_r);
-
- assertSame(obj1_r, obj2_r.obj);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGet() throws Exception {
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- TestObject obj = c.get(i);
-
- assertEquals(i, obj.val);
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- PortableObject po = kpc.get(i);
-
- assertEquals(i, (int)po.field("val"));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testIterator() throws Exception {
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- Map<Integer, TestObject> entries = new HashMap<>();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- TestObject val = new TestObject(i);
-
- c.put(i, val);
-
- entries.put(i, val);
- }
-
- IgniteCache<Integer, PortableObject> prj = ((IgniteCacheProxy)c).keepPortable();
-
- Iterator<Cache.Entry<Integer, PortableObject>> it = prj.iterator();
-
- assertTrue(it.hasNext());
-
- while (it.hasNext()) {
- Cache.Entry<Integer, PortableObject> entry = it.next();
-
- assertTrue(entries.containsKey(entry.getKey()));
-
- TestObject o = entries.get(entry.getKey());
-
- PortableObject po = entry.getValue();
-
- assertEquals(o.val, (int)po.field("val"));
-
- entries.remove(entry.getKey());
- }
-
- assertEquals(0, entries.size());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCollection() throws Exception {
- IgniteCache<Integer, Collection<TestObject>> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- Collection<TestObject> col = new ArrayList<>(3);
-
- for (int j = 0; j < 3; j++)
- col.add(new TestObject(i * 10 + j));
-
- c.put(i, col);
- }
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- Collection<TestObject> col = c.get(i);
-
- assertEquals(3, col.size());
-
- Iterator<TestObject> it = col.iterator();
-
- for (int j = 0; j < 3; j++) {
- assertTrue(it.hasNext());
-
- assertEquals(i * 10 + j, it.next().val);
- }
- }
-
- IgniteCache<Integer, Collection<PortableObject>> kpc = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- Collection<PortableObject> col = kpc.get(i);
-
- assertEquals(3, col.size());
-
- Iterator<PortableObject> it = col.iterator();
-
- for (int j = 0; j < 3; j++) {
- assertTrue(it.hasNext());
-
- assertEquals(i * 10 + j, (int)it.next().field("val"));
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMap() throws Exception {
- IgniteCache<Integer, Map<Integer, TestObject>> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- Map<Integer, TestObject> map = U.newHashMap(3);
-
- for (int j = 0; j < 3; j++) {
- int idx = i * 10 + j;
-
- map.put(idx, new TestObject(idx));
- }
-
- c.put(i, map);
- }
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- Map<Integer, TestObject> map = c.get(i);
-
- assertEquals(3, map.size());
-
- for (int j = 0; j < 3; j++) {
- int idx = i * 10 + j;
-
- assertEquals(idx, map.get(idx).val);
- }
- }
-
- IgniteCache<Integer, Map<Integer, PortableObject>> kpc = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- Map<Integer, PortableObject> map = kpc.get(i);
-
- assertEquals(3, map.size());
-
- for (int j = 0; j < 3; j++) {
- int idx = i * 10 + j;
-
- assertEquals(idx, (int)map.get(idx).field("val"));
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAsync() throws Exception {
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- cacheAsync.get(i);
- TestObject obj = cacheAsync.<TestObject>future().get();
-
- assertEquals(i, obj.val);
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
- IgniteCache<Integer, PortableObject> cachePortableAsync = kpc.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- cachePortableAsync.get(i);
-
- PortableObject po = cachePortableAsync.<PortableObject>future().get();
-
- assertEquals(i, (int)po.field("val"));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetTx() throws Exception {
- if (atomicityMode() != TRANSACTIONAL)
- return;
-
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- TestObject obj = c.get(i);
-
- assertEquals(i, obj.val);
-
- tx.commit();
- }
- }
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
- TestObject obj = c.get(i);
-
- assertEquals(i, obj.val);
-
- tx.commit();
- }
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- PortableObject po = kpc.get(i);
-
- assertEquals(i, (int)po.field("val"));
-
- tx.commit();
- }
- }
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
- PortableObject po = kpc.get(i);
-
- assertEquals(i, (int)po.field("val"));
-
- tx.commit();
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAsyncTx() throws Exception {
- if (atomicityMode() != TRANSACTIONAL)
- return;
-
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- cacheAsync.get(i);
-
- TestObject obj = cacheAsync.<TestObject>future().get();
-
- assertEquals(i, obj.val);
-
- tx.commit();
- }
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
- IgniteCache<Integer, PortableObject> cachePortableAsync = kpc.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; i++) {
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- cachePortableAsync.get(i);
-
- PortableObject po = cachePortableAsync.<PortableObject>future().get();
-
- assertEquals(i, (int)po.field("val"));
-
- tx.commit();
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAll() throws Exception {
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- Map<Integer, TestObject> objs = c.getAll(keys);
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, TestObject> e : objs.entrySet())
- assertEquals(e.getKey().intValue(), e.getValue().val);
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- Map<Integer, PortableObject> objs = kpc.getAll(keys);
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
- assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAllAsync() throws Exception {
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- cacheAsync.getAll(keys);
-
- Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get();
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, TestObject> e : objs.entrySet())
- assertEquals(e.getKey().intValue(), e.getValue().val);
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
- IgniteCache<Integer, PortableObject> cachePortableAsync = kpc.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
-
- cachePortableAsync.getAll(keys);
-
- Map<Integer, PortableObject> objs = cachePortableAsync.<Map<Integer, PortableObject>>future().get();
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
- assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAllTx() throws Exception {
- if (atomicityMode() != TRANSACTIONAL)
- return;
-
- IgniteCache<Integer, TestObject> c = jcache(0);
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- Map<Integer, TestObject> objs = c.getAll(keys);
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, TestObject> e : objs.entrySet())
- assertEquals(e.getKey().intValue(), e.getValue().val);
-
- tx.commit();
- }
-
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
- Map<Integer, TestObject> objs = c.getAll(keys);
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, TestObject> e : objs.entrySet())
- assertEquals(e.getKey().intValue(), e.getValue().val);
-
- tx.commit();
- }
- }
-
- IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- Map<Integer, PortableObject> objs = kpc.getAll(keys);
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
- assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-
- tx.commit();
- }
-
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
- Map<Integer, PortableObject> objs = kpc.getAll(keys);
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
- assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-
- tx.commit();
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAllAsyncTx() throws Exception {
- if (atomicityMode() != TRANSACTIONAL)
- return;
-
- IgniteCache<Integer, TestObject> c = jcache(0);
- IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
- for (int i = 0; i < ENTRY_CNT; i++)
- c.put(i, new TestObject(i));
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- cacheAsync.getAll(keys);
-
- Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get();
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, TestObject> e : objs.entrySet())
- assertEquals(e.getKey().intValue(), e.getValue().val);
-
- tx.commit();
- }
- }
-
- IgniteCache<Integer, PortableObject> cache = keepPortableCache();
-
- for (int i = 0; i < ENTRY_CNT; ) {
- Set<Integer> keys = new HashSet<>();
-
- for (int j = 0; j < 10; j++)
- keys.add(i++);
-
- IgniteCache<Integer, PortableObject> asyncCache = cache.withAsync();
-
- try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- asyncCache.getAll(keys);
-
- Map<Integer, PortableObject> objs = asyncCache.<Map<Integer, PortableObject>>future().get();
-
- assertEquals(10, objs.size());
-
- for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
- assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-
- tx.commit();
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLoadCache() throws Exception {
- for (int i = 0; i < gridCount(); i++)
- jcache(i).localLoadCache(null);
-
- IgniteCache<Integer, TestObject> cache = jcache(0);
-
- assertEquals(3, cache.size(CachePeekMode.PRIMARY));
-
- assertEquals(1, cache.get(1).val);
- assertEquals(2, cache.get(2).val);
- assertEquals(3, cache.get(3).val);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLoadCacheAsync() throws Exception {
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Object, Object> jcache = jcache(i).withAsync();
-
- jcache.loadCache(null);
-
- jcache.future().get();
- }
-
- IgniteCache<Integer, TestObject> cache = jcache(0);
-
- assertEquals(3, cache.size(CachePeekMode.PRIMARY));
-
- assertEquals(1, cache.get(1).val);
- assertEquals(2, cache.get(2).val);
- assertEquals(3, cache.get(3).val);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLoadCacheFilteredAsync() throws Exception {
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, TestObject> c = this.<Integer, TestObject>jcache(i).withAsync();
-
- c.loadCache(new P2<Integer, TestObject>() {
- @Override public boolean apply(Integer key, TestObject val) {
- return val.val < 3;
- }
- });
-
- c.future().get();
- }
-
- IgniteCache<Integer, TestObject> cache = jcache(0);
-
- assertEquals(2, cache.size(CachePeekMode.PRIMARY));
-
- assertEquals(1, cache.get(1).val);
- assertEquals(2, cache.get(2).val);
-
- assertNull(cache.get(3));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTransform() throws Exception {
- IgniteCache<Integer, PortableObject> c = keepPortableCache();
-
- checkTransform(primaryKey(c));
-
- if (cacheMode() != CacheMode.LOCAL) {
- checkTransform(backupKey(c));
-
- if (nearConfiguration() != null)
- checkTransform(nearKey(c));
- }
- }
-
- /**
- * @return Cache with keep portable flag.
- */
- private <K, V> IgniteCache<K, V> keepPortableCache() {
- return ignite(0).cache(null).withKeepPortable();
- }
-
- /**
- * @param key Key.
- * @throws Exception If failed.
- */
- private void checkTransform(Integer key) throws Exception {
- log.info("Transform: " + key);
-
- IgniteCache<Integer, PortableObject> c = keepPortableCache();
-
- try {
- c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
- @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
- PortableObject val = e.getValue();
-
- assertNull("Unexpected value: " + val, val);
-
- return null;
- }
- });
-
- jcache(0).put(key, new TestObject(1));
-
- c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
- @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
- PortableObject val = e.getValue();
-
- assertNotNull("Unexpected value: " + val, val);
-
- assertEquals(new Integer(1), val.field("val"));
-
- Ignite ignite = e.unwrap(Ignite.class);
-
- IgnitePortables portables = ignite.portables();
-
- PortableBuilder builder = portables.builder(val);
-
- builder.setField("val", 2);
-
- e.setValue(builder.build());
-
- return null;
- }
- });
-
- PortableObject obj = c.get(key);
-
- assertEquals(new Integer(2), obj.field("val"));
-
- c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
- @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
- PortableObject val = e.getValue();
-
- assertNotNull("Unexpected value: " + val, val);
-
- assertEquals(new Integer(2), val.field("val"));
-
- e.setValue(val);
-
- return null;
- }
- });
-
- obj = c.get(key);
-
- assertEquals(new Integer(2), obj.field("val"));
-
- c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
- @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
- PortableObject val = e.getValue();
-
- assertNotNull("Unexpected value: " + val, val);
-
- assertEquals(new Integer(2), val.field("val"));
-
- e.remove();
-
- return null;
- }
- });
-
- assertNull(c.get(key));
- }
- finally {
- c.remove(key);
- }
- }
-
- /**
- *
- */
- private static class TestObject implements PortableMarshalAware {
- /** */
- private int val;
-
- /**
- */
- private TestObject() {
- // No-op.
- }
-
- /**
- * @param val Value.
- */
- private TestObject(int val) {
- this.val = val;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeInt("val", val);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- val = reader.readInt("val");
- }
- }
-
- /**
- *
- */
- private static class TestReferenceObject implements PortableMarshalAware {
- /** */
- private TestReferenceObject obj;
-
- /**
- */
- private TestReferenceObject() {
- // No-op.
- }
-
- /**
- * @param obj Object.
- */
- private TestReferenceObject(TestReferenceObject obj) {
- this.obj = obj;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeObject("obj", obj);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- obj = reader.readObject("obj");
- }
- }
-
- /**
- *
- */
- private static class TestStore extends CacheStoreAdapter<Integer, Object> {
- /** {@inheritDoc} */
- @Override public void loadCache(IgniteBiInClosure<Integer, Object> clo, Object... args) {
- for (int i = 1; i <= 3; i++)
- clo.apply(i, new TestObject(i));
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object load(Integer key) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void write(Cache.Entry<? extends Integer, ?> e) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void delete(Object key) {
- // No-op.
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java
deleted file mode 100644
index 7c605b5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java
+++ /dev/null
@@ -1,297 +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.processors.cache.portable;
-
-import com.google.common.collect.ImmutableSet;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import javax.cache.Cache;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
-import org.jsr166.ConcurrentHashMap8;
-
-/**
- * Tests for cache store with portables.
- */
-public abstract class GridCachePortableStoreAbstractSelfTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final TestStore STORE = new TestStore();
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- CacheConfiguration cacheCfg = new CacheConfiguration();
-
- cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
- cacheCfg.setKeepPortableInStore(keepPortableInStore());
- cacheCfg.setReadThrough(true);
- cacheCfg.setWriteThrough(true);
- cacheCfg.setLoadPreviousValue(true);
-
- cfg.setCacheConfiguration(cacheCfg);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(disco);
-
- return cfg;
- }
-
- /**
- * @return Keep portables in store flag.
- */
- protected abstract boolean keepPortableInStore();
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrid();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopGrid();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- STORE.map().clear();
-
- jcache().clear();
-
- assert jcache().size() == 0;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPut() throws Exception {
- jcache().put(new Key(1), new Value(1));
-
- checkMap(STORE.map(), 1);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutAll() throws Exception {
- Map<Object, Object> map = new HashMap<>();
-
- for (int i = 1; i <= 3; i++)
- map.put(new Key(i), new Value(i));
-
- jcache().putAll(map);
-
- checkMap(STORE.map(), 1, 2, 3);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLoad() throws Exception {
- populateMap(STORE.map(), 1);
-
- Object val = jcache().get(new Key(1));
-
- assertTrue(String.valueOf(val), val instanceof Value);
-
- assertEquals(1, ((Value)val).index());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLoadAll() throws Exception {
- populateMap(STORE.map(), 1, 2, 3);
-
- Set<Object> keys = new HashSet<>();
-
- for (int i = 1; i <= 3; i++)
- keys.add(new Key(i));
-
- Map<Object, Object> res = jcache().getAll(keys);
-
- assertEquals(3, res.size());
-
- for (int i = 1; i <= 3; i++) {
- Object val = res.get(new Key(i));
-
- assertTrue(String.valueOf(val), val instanceof Value);
-
- assertEquals(i, ((Value)val).index());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemove() throws Exception {
- for (int i = 1; i <= 3; i++)
- jcache().put(new Key(i), new Value(i));
-
- jcache().remove(new Key(1));
-
- checkMap(STORE.map(), 2, 3);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoveAll() throws Exception {
- for (int i = 1; i <= 3; i++)
- jcache().put(new Key(i), new Value(i));
-
- jcache().removeAll(ImmutableSet.of(new Key(1), new Key(2)));
-
- checkMap(STORE.map(), 3);
- }
-
- /**
- * @param map Map.
- * @param idxs Indexes.
- */
- protected abstract void populateMap(Map<Object, Object> map, int... idxs);
-
- /**
- * @param map Map.
- * @param idxs Indexes.
- */
- protected abstract void checkMap(Map<Object, Object> map, int... idxs);
-
- /**
- */
- protected static class Key {
- /** */
- private int idx;
-
- /**
- * @param idx Index.
- */
- public Key(int idx) {
- this.idx = idx;
- }
-
- /**
- * @return Index.
- */
- int index() {
- return idx;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- Key key = (Key)o;
-
- return idx == key.idx;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return idx;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Key [idx=" + idx + ']';
- }
- }
-
- /**
- */
- protected static class Value {
- /** */
- private int idx;
-
- /**
- * @param idx Index.
- */
- public Value(int idx) {
- this.idx = idx;
- }
-
- /**
- * @return Index.
- */
- int index() {
- return idx;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Value [idx=" + idx + ']';
- }
- }
-
- /**
- *
- */
- private static class TestStore extends CacheStoreAdapter<Object, Object> {
- /** */
- private final Map<Object, Object> map = new ConcurrentHashMap8<>();
-
- /** {@inheritDoc} */
- @Nullable @Override public Object load(Object key) {
- return map.get(key);
- }
-
- /** {@inheritDoc} */
- @Override public void write(Cache.Entry<?, ?> e) {
- map.put(e.getKey(), e.getValue());
- }
-
- /** {@inheritDoc} */
- @Override public void delete(Object key) {
- map.remove(key);
- }
-
- /**
- * @return Map.
- */
- Map<Object, Object> map() {
- return map;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java
deleted file mode 100644
index 1c1c99e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java
+++ /dev/null
@@ -1,55 +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.processors.cache.portable;
-
-import java.util.Map;
-
-/**
- * Tests for cache store with portables.
- */
-public class GridCachePortableStoreObjectsSelfTest extends GridCachePortableStoreAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean keepPortableInStore() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected void populateMap(Map<Object, Object> map, int... idxs) {
- assert map != null;
- assert idxs != null;
-
- for (int idx : idxs)
- map.put(new Key(idx), new Value(idx));
- }
-
- /** {@inheritDoc} */
- @Override protected void checkMap(Map<Object, Object> map, int... idxs) {
- assert map != null;
- assert idxs != null;
-
- assertEquals(idxs.length, map.size());
-
- for (int idx : idxs) {
- Object val = map.get(new Key(idx));
-
- assertTrue(String.valueOf(val), val instanceof Value);
-
- assertEquals(idx, ((Value)val).index());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java
deleted file mode 100644
index 5c0fc8e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java
+++ /dev/null
@@ -1,66 +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.processors.cache.portable;
-
-import java.util.Map;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Tests for cache store with portables.
- */
-public class GridCachePortableStorePortablesSelfTest extends GridCachePortableStoreAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean keepPortableInStore() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected void populateMap(Map<Object, Object> map, int... idxs) {
- assert map != null;
- assert idxs != null;
-
- for (int idx : idxs)
- map.put(portable(new Key(idx)), portable(new Value(idx)));
- }
-
- /** {@inheritDoc} */
- @Override protected void checkMap(Map<Object, Object> map, int... idxs) {
- assert map != null;
- assert idxs != null;
-
- assertEquals(idxs.length, map.size());
-
- for (int idx : idxs) {
- Object val = map.get(portable(new Key(idx)));
-
- assertTrue(String.valueOf(val), val instanceof PortableObject);
-
- PortableObject po = (PortableObject)val;
-
- assertEquals("Value", po.metaData().typeName());
- assertEquals(new Integer(idx), po.field("idx"));
- }
- }
-
- /**
- * @param obj Object.
- * @return Portable object.
- */
- private Object portable(Object obj) {
- return grid().portables().toPortable(obj);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java
deleted file mode 100644
index 0db650e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java
+++ /dev/null
@@ -1,55 +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.processors.cache.portable;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.internal.portable.PortableMetaDataHandler;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-
-/**
- *
- */
-public class GridPortableCacheEntryMemorySizeSelfTest extends GridCacheEntryMemorySizeSelfTest {
- /** {@inheritDoc} */
- @Override protected Marshaller createMarshaller() throws IgniteCheckedException {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setContext(new MarshallerContextTestImpl(null));
-
- PortableContext pCtx = new PortableContext(new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, PortableMetadata meta) throws PortableException {
- // No-op
- }
-
- @Override public PortableMetadata metadata(int typeId) throws PortableException {
- return null;
- }
- }, null);
-
- IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", pCtx);
-
- return marsh;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java
deleted file mode 100644
index a1a623b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java
+++ /dev/null
@@ -1,158 +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.processors.cache.portable;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Tests that portable object is the same in cache entry and in index.
- */
-public abstract class GridPortableDuplicateIndexObjectsAbstractSelfTest extends GridCacheAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 1;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Collections.singletonList(TestPortable.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration ccfg = super.cacheConfiguration(gridName);
-
- ccfg.setCopyOnRead(false);
-
- CacheTypeMetadata meta = new CacheTypeMetadata();
-
- meta.setKeyType(Integer.class);
- meta.setValueType(TestPortable.class.getName());
-
- Map<String, Class<?>> idx = new HashMap<>();
-
- idx.put("fieldOne", String.class);
- idx.put("fieldTwo", Integer.class);
-
- meta.setAscendingFields(idx);
-
- ccfg.setTypeMetadata(Collections.singletonList(meta));
-
- return ccfg;
- }
-
- /** {@inheritDoc} */
- @Override public abstract CacheAtomicityMode atomicityMode();
-
- /** {@inheritDoc} */
- @Override public abstract CacheMode cacheMode();
-
- /**
- * @throws Exception If failed.
- */
- public void testIndexReferences() throws Exception {
- IgniteCache<Integer, TestPortable> cache = grid(0).cache(null);
-
- String fieldOneVal = "123";
- int fieldTwoVal = 123;
- int key = 0;
-
- cache.put(key, new TestPortable(fieldOneVal, fieldTwoVal));
-
- IgniteCache<Integer, PortableObject> prj = grid(0).cache(null).withKeepPortable();
-
- PortableObject cacheVal = prj.get(key);
-
- assertEquals(fieldOneVal, cacheVal.field("fieldOne"));
- assertEquals(new Integer(fieldTwoVal), cacheVal.field("fieldTwo"));
-
- List<?> row = F.first(prj.query(new SqlFieldsQuery("select _val from " +
- "TestPortable where _key = ?").setArgs(key)).getAll());
-
- assertEquals(1, row.size());
-
- PortableObject qryVal = (PortableObject)row.get(0);
-
- assertEquals(fieldOneVal, qryVal.field("fieldOne"));
- assertEquals(new Integer(fieldTwoVal), qryVal.field("fieldTwo"));
- assertSame(cacheVal, qryVal);
- }
-
- /**
- * Test portable object.
- */
- private static class TestPortable {
- /** */
- private String fieldOne;
-
- /** */
- private int fieldTwo;
-
- /**
- *
- */
- private TestPortable() {
- // No-op.
- }
-
- /**
- * @param fieldOne Field one.
- * @param fieldTwo Field two.
- */
- private TestPortable(String fieldOne, int fieldTwo) {
- this.fieldOne = fieldOne;
- this.fieldTwo = fieldTwo;
- }
-
- /**
- * @return Field one.
- */
- public String fieldOne() {
- return fieldOne;
- }
-
- /**
- * @return Field two.
- */
- public int fieldTwo() {
- return fieldTwo;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
deleted file mode 100644
index 836440a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
+++ /dev/null
@@ -1,66 +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.processors.cache.portable.datastreaming;
-
-import java.util.Collection;
-import java.util.Map;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.stream.StreamReceiver;
-
-/**
- *
- */
-public class DataStreamProcessorPortableSelfTest extends DataStreamProcessorSelfTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected StreamReceiver<String, TestObject> getStreamReceiver() {
- return new TestDataReceiver();
- }
-
- /**
- *
- */
- private static class TestDataReceiver implements StreamReceiver<String, TestObject> {
- /** {@inheritDoc} */
- @Override public void receive(IgniteCache<String, TestObject> cache,
- Collection<Map.Entry<String, TestObject>> entries) {
- for (Map.Entry<String, TestObject> e : entries) {
- assertTrue(e.getKey() instanceof String);
- assertTrue(e.getValue() instanceof PortableObject);
-
- TestObject obj = ((PortableObject)e.getValue()).deserialize();
-
- cache.put(e.getKey(), new TestObject(obj.val + 1));
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java
deleted file mode 100644
index 2f7bdb0..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java
+++ /dev/null
@@ -1,345 +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.processors.cache.portable.datastreaming;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Random;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Tests for {@code IgniteDataStreamerImpl}.
- */
-public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** Number of keys to load via data streamer. */
- private static final int KEYS_COUNT = 1000;
-
- /** Flag indicating should be cache configured with portables or not. */
- private static boolean portables;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
- discoSpi.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(discoSpi);
-
- if (portables) {
- PortableMarshaller marsh = new PortableMarshaller();
-
- cfg.setMarshaller(marsh);
- }
-
- cfg.setCacheConfiguration(cacheConfiguration());
-
- return cfg;
- }
-
- /**
- * Gets cache configuration.
- *
- * @return Cache configuration.
- */
- private CacheConfiguration cacheConfiguration() {
- CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
- cacheCfg.setCacheMode(PARTITIONED);
- cacheCfg.setNearConfiguration(null);
- cacheCfg.setBackups(0);
- cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
-
- return cacheCfg;
- }
-
- /**
- * Data streamer should correctly load entries from HashMap in case of grids with more than one node
- * and with GridOptimizedMarshaller that requires serializable.
- *
- * @throws Exception If failed.
- */
- public void testAddDataFromMap() throws Exception {
- try {
- portables = false;
-
- startGrids(2);
-
- awaitPartitionMapExchange();
-
- Ignite g0 = grid(0);
-
- IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(null);
-
- Map<Integer, String> map = U.newHashMap(KEYS_COUNT);
-
- for (int i = 0; i < KEYS_COUNT; i ++)
- map.put(i, String.valueOf(i));
-
- dataLdr.addData(map);
-
- dataLdr.close();
-
- checkDistribution(grid(0));
-
- checkDistribution(grid(1));
-
- // Check several random keys in cache.
- Random rnd = new Random();
-
- IgniteCache<Integer, String> c0 = g0.cache(null);
-
- for (int i = 0; i < 100; i ++) {
- Integer k = rnd.nextInt(KEYS_COUNT);
-
- String v = c0.get(k);
-
- assertEquals(k.toString(), v);
- }
- }
- finally {
- G.stopAll(true);
- }
- }
-
- /**
- * Data streamer should add portable object that weren't registered explicitly.
- *
- * @throws Exception If failed.
- */
- public void testAddMissingPortable() throws Exception {
- try {
- portables = true;
-
- startGrids(2);
-
- awaitPartitionMapExchange();
-
- Ignite g0 = grid(0);
-
- IgniteDataStreamer<Integer, TestObject2> dataLdr = g0.dataStreamer(null);
-
- dataLdr.perNodeBufferSize(1);
- dataLdr.autoFlushFrequency(1L);
-
- Map<Integer, TestObject2> map = U.newHashMap(KEYS_COUNT);
-
- for (int i = 0; i < KEYS_COUNT; i ++)
- map.put(i, new TestObject2(i));
-
- dataLdr.addData(map).get();
-
- dataLdr.close();
- }
- finally {
- G.stopAll(true);
- }
- }
-
- /**
- * Data streamer should correctly load portable entries from HashMap in case of grids with more than one node
- * and with GridOptimizedMarshaller that requires serializable.
- *
- * @throws Exception If failed.
- */
- public void testAddPortableDataFromMap() throws Exception {
- try {
- portables = true;
-
- startGrids(2);
-
- awaitPartitionMapExchange();
-
- Ignite g0 = grid(0);
-
- IgniteDataStreamer<Integer, TestObject> dataLdr = g0.dataStreamer(null);
-
- Map<Integer, TestObject> map = U.newHashMap(KEYS_COUNT);
-
- for (int i = 0; i < KEYS_COUNT; i ++)
- map.put(i, new TestObject(i));
-
- dataLdr.addData(map);
-
- dataLdr.close(false);
-
- checkDistribution(grid(0));
-
- checkDistribution(grid(1));
-
- // Read random keys. Take values as TestObject.
- Random rnd = new Random();
-
- IgniteCache<Integer, TestObject> c = g0.cache(null);
-
- for (int i = 0; i < 100; i ++) {
- Integer k = rnd.nextInt(KEYS_COUNT);
-
- TestObject v = c.get(k);
-
- assertEquals(k, v.val());
- }
-
- // Read random keys. Take values as PortableObject.
- IgniteCache<Integer, PortableObject> c2 = ((IgniteCacheProxy)c).keepPortable();
-
- for (int i = 0; i < 100; i ++) {
- Integer k = rnd.nextInt(KEYS_COUNT);
-
- PortableObject v = c2.get(k);
-
- assertEquals(k, v.field("val"));
- }
- }
- finally {
- G.stopAll(true);
- }
- }
-
- /**
- * Check that keys correctly destributed by nodes after data streamer.
- *
- * @param g Grid to check.
- */
- private void checkDistribution(Ignite g) {
- ClusterNode n = g.cluster().localNode();
- IgniteCache c = g.cache(null);
-
- // Check that data streamer correctly split data by nodes.
- for (int i = 0; i < KEYS_COUNT; i ++) {
- if (g.affinity(null).isPrimary(n, i))
- assertNotNull(c.localPeek(i, CachePeekMode.ONHEAP));
- else
- assertNull(c.localPeek(i, CachePeekMode.ONHEAP));
- }
- }
-
- /**
- */
- private static class TestObject implements PortableMarshalAware, Serializable {
- /** */
- private int val;
-
- /**
- *
- */
- private TestObject() {
- // No-op.
- }
-
- /**
- * @param val Value.
- */
- private TestObject(int val) {
- this.val = val;
- }
-
- public Integer val() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return obj instanceof TestObject && ((TestObject)obj).val == val;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeInt("val", val);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- val = reader.readInt("val");
- }
- }
-
- /**
- */
- private static class TestObject2 implements PortableMarshalAware, Serializable {
- /** */
- private int val;
-
- /**
- */
- private TestObject2() {
- // No-op.
- }
-
- /**
- * @param val Value.
- */
- private TestObject2(int val) {
- this.val = val;
- }
-
- public Integer val() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return obj instanceof TestObject2 && ((TestObject2)obj).val == val;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeInt("val", val);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- val = reader.readInt("val");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java
deleted file mode 100644
index 155ba48..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java
+++ /dev/null
@@ -1,47 +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.processors.cache.portable.distributed.dht;
-
-import java.util.Collections;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-
-/**
- *
- */
-public class GridCacheAffinityRoutingPortableSelfTest extends GridCacheAffinityRoutingSelfTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
- typeCfg.setClassName(AffinityTestKey.class.getName());
- typeCfg.setAffinityKeyFieldName("affKey");
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Collections.singleton(typeCfg));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java
deleted file mode 100644
index b3b988e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java
+++ /dev/null
@@ -1,29 +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.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest extends
- GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest {
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 4;
- }
-}
\ No newline at end of file
[13/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
ignite-1462: hid portable API in 1.4 release
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/71379a80
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/71379a80
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/71379a80
Branch: refs/heads/ignite-1093-2
Commit: 71379a8061f50f336adc31fa20cd593b659b050f
Parents: b4c515e
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Sep 14 17:24:27 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Sep 14 17:24:29 2015 +0300
----------------------------------------------------------------------
examples/config/example-default.xml | 76 -
examples/config/example-ignite.xml | 56 +-
.../config/portable/example-ignite-portable.xml | 44 -
.../ignite/examples/portable/Address.java | 72 -
.../ignite/examples/portable/Employee.java | 93 -
.../ignite/examples/portable/EmployeeKey.java | 90 -
.../portable/ExamplePortableNodeStartup.java | 36 -
.../ignite/examples/portable/Organization.java | 93 -
.../examples/portable/OrganizationType.java | 32 -
...mputeClientPortableTaskExecutionExample.java | 154 -
.../portable/computegrid/ComputeClientTask.java | 116 -
.../portable/computegrid/package-info.java | 21 -
.../CacheClientPortablePutGetExample.java | 230 --
.../CacheClientPortableQueryExample.java | 325 --
.../portable/datagrid/package-info.java | 21 -
.../ignite/examples/portable/package-info.java | 21 -
.../CacheClientPortableExampleTest.java | 46 -
.../ComputeClientPortableExampleTest.java | 37 -
.../testsuites/IgniteExamplesSelfTestSuite.java | 6 -
modules/core/pom.xml | 21 -
.../src/main/java/org/apache/ignite/Ignite.java | 7 -
.../java/org/apache/ignite/IgniteCache.java | 44 +-
.../java/org/apache/ignite/IgnitePortables.java | 370 --
.../configuration/CacheConfiguration.java | 70 +-
.../org/apache/ignite/internal/IgniteEx.java | 9 +
.../apache/ignite/internal/IgniteKernal.java | 8 +-
.../ignite/internal/IgniteNodeAttributes.java | 5 +-
.../discovery/GridDiscoveryManager.java | 10 -
.../portable/GridPortableMarshaller.java | 2 +-
.../portable/PortableClassDescriptor.java | 10 +-
.../internal/portable/PortableContext.java | 14 +-
.../portable/PortableMetaDataCollector.java | 6 +-
.../portable/PortableMetaDataHandler.java | 4 +-
.../internal/portable/PortableMetaDataImpl.java | 14 +-
.../internal/portable/PortableObjectEx.java | 6 +-
.../internal/portable/PortableObjectImpl.java | 6 +-
.../portable/PortableObjectOffheapImpl.java | 6 +-
.../internal/portable/PortableRawReaderEx.java | 4 +-
.../internal/portable/PortableRawWriterEx.java | 4 +-
.../portable/PortableReaderContext.java | 2 +-
.../internal/portable/PortableReaderExImpl.java | 10 +-
.../ignite/internal/portable/PortableUtils.java | 2 +-
.../internal/portable/PortableWriterExImpl.java | 11 +-
.../internal/portable/api/IgnitePortables.java | 362 ++
.../internal/portable/api/PortableBuilder.java | 136 +
.../portable/api/PortableException.java | 57 +
.../internal/portable/api/PortableIdMapper.java | 54 +
.../api/PortableInvalidClassException.java | 58 +
.../portable/api/PortableMarshalAware.java | 48 +
.../portable/api/PortableMarshaller.java | 358 ++
.../internal/portable/api/PortableMetadata.java | 60 +
.../internal/portable/api/PortableObject.java | 152 +
.../portable/api/PortableProtocolVersion.java | 41 +
.../portable/api/PortableRawReader.java | 234 ++
.../portable/api/PortableRawWriter.java | 219 +
.../internal/portable/api/PortableReader.java | 284 ++
.../portable/api/PortableSerializer.java | 47 +
.../portable/api/PortableTypeConfiguration.java | 195 +
.../internal/portable/api/PortableWriter.java | 266 ++
.../portable/builder/PortableBuilderEnum.java | 2 +-
.../portable/builder/PortableBuilderImpl.java | 14 +-
.../portable/builder/PortableBuilderReader.java | 2 +-
.../builder/PortableBuilderSerializer.java | 2 +-
.../builder/PortableEnumArrayLazyValue.java | 4 +-
.../builder/PortableObjectArrayLazyValue.java | 2 +-
.../builder/PortablePlainPortableObject.java | 2 +-
.../streams/PortableAbstractInputStream.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 8 +-
.../processors/cache/IgniteCacheProxy.java | 5 -
.../CacheDefaultPortableAffinityKeyMapper.java | 2 +-
.../portable/CacheObjectPortableContext.java | 2 +-
.../portable/CacheObjectPortableProcessor.java | 8 +-
.../CacheObjectPortableProcessorImpl.java | 12 +-
.../cache/portable/IgnitePortablesImpl.java | 10 +-
.../cache/store/CacheOsStoreManager.java | 4 +-
.../dotnet/PlatformDotNetConfiguration.java | 12 +-
.../PlatformDotNetPortableConfiguration.java | 12 +-
...PlatformDotNetPortableTypeConfiguration.java | 12 +-
.../marshaller/portable/PortableMarshaller.java | 358 --
.../marshaller/portable/package-info.java | 22 -
.../apache/ignite/portable/PortableBuilder.java | 137 -
.../ignite/portable/PortableException.java | 57 -
.../ignite/portable/PortableIdMapper.java | 56 -
.../portable/PortableInvalidClassException.java | 58 -
.../ignite/portable/PortableMarshalAware.java | 48 -
.../ignite/portable/PortableMetadata.java | 61 -
.../apache/ignite/portable/PortableObject.java | 154 -
.../portable/PortableProtocolVersion.java | 41 -
.../ignite/portable/PortableRawReader.java | 234 --
.../ignite/portable/PortableRawWriter.java | 219 -
.../apache/ignite/portable/PortableReader.java | 284 --
.../ignite/portable/PortableSerializer.java | 49 -
.../portable/PortableTypeConfiguration.java | 196 -
.../apache/ignite/portable/PortableWriter.java | 266 --
.../apache/ignite/portable/package-info.java | 22 -
.../resources/META-INF/classnames.properties | 8 +-
.../GridDiscoveryManagerAttributesSelfTest.java | 45 -
.../GridPortableAffinityKeySelfTest.java | 218 -
.../GridPortableBuilderAdditionalSelfTest.java | 1226 ------
.../portable/GridPortableBuilderSelfTest.java | 1021 -----
...eBuilderStringAsCharsAdditionalSelfTest.java | 28 -
...ridPortableBuilderStringAsCharsSelfTest.java | 28 -
...idPortableMarshallerCtxDisabledSelfTest.java | 256 --
.../GridPortableMarshallerSelfTest.java | 3807 ------------------
.../GridPortableMetaDataDisabledSelfTest.java | 238 --
.../portable/GridPortableMetaDataSelfTest.java | 371 --
.../portable/GridPortableWildcardsSelfTest.java | 482 ---
.../GridPortableMarshalerAwareTestClass.java | 67 -
.../mutabletest/GridPortableTestClasses.java | 434 --
.../portable/mutabletest/package-info.java | 22 -
.../ignite/internal/portable/package-info.java | 22 -
.../portable/test/GridPortableTestClass1.java | 28 -
.../portable/test/GridPortableTestClass2.java | 24 -
.../internal/portable/test/package-info.java | 22 -
.../test/subpackage/GridPortableTestClass3.java | 24 -
.../portable/test/subpackage/package-info.java | 22 -
...ClientNodePortableMetadataMultinodeTest.java | 295 --
...GridCacheClientNodePortableMetadataTest.java | 286 --
...ableObjectsAbstractDataStreamerSelfTest.java | 190 -
...bleObjectsAbstractMultiThreadedSelfTest.java | 231 --
...ridCachePortableObjectsAbstractSelfTest.java | 978 -----
.../GridCachePortableStoreAbstractSelfTest.java | 297 --
.../GridCachePortableStoreObjectsSelfTest.java | 55 -
...GridCachePortableStorePortablesSelfTest.java | 66 -
...ridPortableCacheEntryMemorySizeSelfTest.java | 55 -
...leDuplicateIndexObjectsAbstractSelfTest.java | 158 -
.../DataStreamProcessorPortableSelfTest.java | 66 -
.../GridDataStreamerImplSelfTest.java | 345 --
...ridCacheAffinityRoutingPortableSelfTest.java | 47 -
...lyPortableDataStreamerMultiNodeSelfTest.java | 29 -
...rtableDataStreamerMultithreadedSelfTest.java | 47 -
...artitionedOnlyPortableMultiNodeSelfTest.java | 28 -
...tionedOnlyPortableMultithreadedSelfTest.java | 47 -
.../GridCacheMemoryModePortableSelfTest.java | 36 -
...acheOffHeapTieredAtomicPortableSelfTest.java | 47 -
...eapTieredEvictionAtomicPortableSelfTest.java | 95 -
...heOffHeapTieredEvictionPortableSelfTest.java | 95 -
.../GridCacheOffHeapTieredPortableSelfTest.java | 47 -
...ateIndexObjectPartitionedAtomicSelfTest.java | 38 -
...xObjectPartitionedTransactionalSelfTest.java | 41 -
...AtomicNearDisabledOffheapTieredSelfTest.java | 29 -
...rtableObjectsAtomicNearDisabledSelfTest.java | 51 -
...tableObjectsAtomicOffheapTieredSelfTest.java | 29 -
.../GridCachePortableObjectsAtomicSelfTest.java | 51 -
...tionedNearDisabledOffheapTieredSelfTest.java | 30 -
...eObjectsPartitionedNearDisabledSelfTest.java | 51 -
...ObjectsPartitionedOffheapTieredSelfTest.java | 30 -
...CachePortableObjectsPartitionedSelfTest.java | 51 -
...sNearPartitionedByteArrayValuesSelfTest.java | 41 -
...sPartitionedOnlyByteArrayValuesSelfTest.java | 42 -
...dCachePortableObjectsReplicatedSelfTest.java | 51 -
...CachePortableObjectsAtomicLocalSelfTest.java | 32 -
...rtableObjectsLocalOffheapTieredSelfTest.java | 29 -
.../GridCachePortableObjectsLocalSelfTest.java | 51 -
.../ignite/testframework/junits/IgniteMock.java | 8 +-
.../multijvm/IgniteCacheProcessProxy.java | 5 -
.../junits/multijvm/IgniteProcessProxy.java | 2 +-
.../IgnitePortableCacheFullApiTestSuite.java | 37 -
.../IgnitePortableCacheTestSuite.java | 103 -
.../IgnitePortableObjectsTestSuite.java | 92 -
.../ignite/portable/test1/1.1/test1-1.1.jar | Bin 2548 -> 0 bytes
.../ignite/portable/test1/1.1/test1-1.1.pom | 9 -
.../portable/test1/maven-metadata-local.xml | 12 -
.../ignite/portable/test2/1.1/test2-1.1.jar | Bin 1361 -> 0 bytes
.../ignite/portable/test2/1.1/test2-1.1.pom | 9 -
.../portable/test2/maven-metadata-local.xml | 12 -
.../HadoopDefaultMapReducePlannerSelfTest.java | 6 +
.../IgnitePortableCacheQueryTestSuite.java | 117 -
.../platform/PlatformContextImpl.java | 4 +-
.../platform/compute/PlatformCompute.java | 2 +-
.../cpp/PlatformCppConfigurationClosure.java | 2 +-
.../PlatformDotNetConfigurationClosure.java | 6 +-
.../Config/Compute/compute-grid1.xml | 8 +-
.../PlatformComputePortableArgTask.java | 8 +-
.../org/apache/ignite/IgniteSpringBean.java | 7 -
parent/pom.xml | 10 -
176 files changed, 2778 insertions(+), 17425 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/config/example-default.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-default.xml b/examples/config/example-default.xml
deleted file mode 100644
index e6c359d..0000000
--- a/examples/config/example-default.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite configuration with all defaults and enabled p2p deployment and enabled events.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <!-- Enable task execution events for examples. -->
- <property name="includeEventTypes">
- <list>
- <!--Task execution events-->
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
-
- <!--Cache events-->
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <!--
- Ignite provides several options for automatic discovery that can be used
- instead os static IP based discovery. For information on all options refer
- to our documentation: http://apacheignite.readme.io/docs/cluster-config
- -->
- <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47509</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-ignite.xml b/examples/config/example-ignite.xml
index d842a6d..e7adb54 100644
--- a/examples/config/example-ignite.xml
+++ b/examples/config/example-ignite.xml
@@ -22,18 +22,62 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <!-- Imports default Ignite configuration -->
- <import resource="example-default.xml"/>
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <!-- Set to true to enable distributed class loading for examples, default is false. -->
+ <property name="peerClassLoadingEnabled" value="true"/>
- <bean parent="ignite.cfg">
- <!-- Enabled optimized marshaller -->
<property name="marshaller">
<bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
<!-- Set to false to allow non-serializable objects in examples, default is true. -->
<property name="requireSerializable" value="false"/>
</bean>
</property>
+
+ <!-- Enable task execution events for examples. -->
+ <property name="includeEventTypes">
+ <list>
+ <!--Task execution events-->
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
+
+ <!--Cache events-->
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
+ <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
+ </list>
+ </property>
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Ignite provides several options for automatic discovery that can be used
+ instead os static IP based discovery. For information on all options refer
+ to our documentation: http://apacheignite.readme.io/docs/cluster-config
+ -->
+ <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47509</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
</bean>
</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/config/portable/example-ignite-portable.xml
----------------------------------------------------------------------
diff --git a/examples/config/portable/example-ignite-portable.xml b/examples/config/portable/example-ignite-portable.xml
deleted file mode 100644
index cde15ea..0000000
--- a/examples/config/portable/example-ignite-portable.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite configuration with all defaults and enabled p2p deployment, events and portable marshaller.
-
- Use this configuration file when running HTTP REST examples (see 'examples/rest' folder).
-
- When starting a standalone node, you need to execute the following command:
- {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/portable/example-ignite-portable.xml
-
- When starting Ignite from Java IDE, pass path to this file to Ignition:
- Ignition.start("examples/config/portable/example-ignite-portable.xml");
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <!-- Imports default Ignite configuration -->
- <import resource="../example-default.xml"/>
-
- <bean parent="ignite.cfg">
- <!-- Enables portable marshaller -->
- <property name="marshaller">
- <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"/>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Address.java b/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
deleted file mode 100644
index cb08b25..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
+++ /dev/null
@@ -1,72 +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.examples.portable;
-
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-
-/**
- * Employee address.
- * <p>
- * This class implements {@link PortableMarshalAware} only for example purposes,
- * in order to show how to customize serialization and deserialization of
- * portable objects.
- */
-public class Address implements PortableMarshalAware {
- /** Street. */
- private String street;
-
- /** ZIP code. */
- private int zip;
-
- /**
- * Required for portable deserialization.
- */
- public Address() {
- // No-op.
- }
-
- /**
- * @param street Street.
- * @param zip ZIP code.
- */
- public Address(String street, int zip) {
- this.street = street;
- this.zip = zip;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeString("street", street);
- writer.writeInt("zip", zip);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- street = reader.readString("street");
- zip = reader.readInt("zip");
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Address [street=" + street +
- ", zip=" + zip + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java b/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
deleted file mode 100644
index 9614168..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
+++ /dev/null
@@ -1,93 +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.examples.portable;
-
-import java.util.Collection;
-
-/**
- * This class represents employee object.
- */
-public class Employee {
- /** Name. */
- private String name;
-
- /** Salary. */
- private long salary;
-
- /** Address. */
- private Address address;
-
- /** Departments. */
- private Collection<String> departments;
-
- /**
- * Required for portable deserialization.
- */
- public Employee() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param salary Salary.
- * @param address Address.
- * @param departments Departments.
- */
- public Employee(String name, long salary, Address address, Collection<String> departments) {
- this.name = name;
- this.salary = salary;
- this.address = address;
- this.departments = departments;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Salary.
- */
- public long salary() {
- return salary;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return address;
- }
-
- /**
- * @return Departments.
- */
- public Collection<String> departments() {
- return departments;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Employee [name=" + name +
- ", salary=" + salary +
- ", address=" + address +
- ", departments=" + departments + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
deleted file mode 100644
index f322167..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
+++ /dev/null
@@ -1,90 +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.examples.portable;
-
-/**
- * This class represents key for employee object.
- * <p>
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
- /** ID. */
- private int id;
-
- /** Organization ID. */
- private int organizationId;
-
- /**
- * Required for portable deserialization.
- */
- public EmployeeKey() {
- // No-op.
- }
-
- /**
- * @param id ID.
- * @param organizationId Organization ID.
- */
- public EmployeeKey(int id, int organizationId) {
- this.id = id;
- this.organizationId = organizationId;
- }
-
- /**
- * @return ID.
- */
- public int id() {
- return id;
- }
-
- /**
- * @return Organization ID.
- */
- public int organizationId() {
- return organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- EmployeeKey key = (EmployeeKey)o;
-
- return id == key.id && organizationId == key.organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = id;
-
- res = 31 * res + organizationId;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "EmployeeKey [id=" + id +
- ", organizationId=" + organizationId + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
deleted file mode 100644
index 87a41f7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
+++ /dev/null
@@ -1,36 +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.examples.portable;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-
-/**
- * Starts up an empty node with example configuration and portable marshaller enabled.
- */
-public class ExamplePortableNodeStartup {
- /**
- * Start up an empty node with example configuration and portable marshaller enabled.
- *
- * @param args Command line arguments, none required.
- * @throws IgniteException If failed.
- */
- public static void main(String[] args) throws IgniteException {
- Ignition.start("examples/config/portable/example-ignite-portable.xml");
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java b/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
deleted file mode 100644
index f52cac1..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
+++ /dev/null
@@ -1,93 +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.examples.portable;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
- /** Name. */
- private String name;
-
- /** Address. */
- private Address address;
-
- /** Type. */
- private OrganizationType type;
-
- /** Last update time. */
- private Timestamp lastUpdated;
-
- /**
- * Required for portable deserialization.
- */
- public Organization() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param address Address.
- * @param type Type.
- * @param lastUpdated Last update time.
- */
- public Organization(String name, Address address, OrganizationType type, Timestamp lastUpdated) {
- this.name = name;
- this.address = address;
- this.type = type;
- this.lastUpdated = lastUpdated;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return address;
- }
-
- /**
- * @return Type.
- */
- public OrganizationType type() {
- return type;
- }
-
- /**
- * @return Last update time.
- */
- public Timestamp lastUpdated() {
- return lastUpdated;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Organization [name=" + name +
- ", address=" + address +
- ", type=" + type +
- ", lastUpdated=" + lastUpdated + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
deleted file mode 100644
index c753e2d..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
+++ /dev/null
@@ -1,32 +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.examples.portable;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
- /** Non-profit organization. */
- NON_PROFIT,
-
- /** Private organization. */
- PRIVATE,
-
- /** Government organization. */
- GOVERNMENT
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
deleted file mode 100644
index 34d9cde..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
+++ /dev/null
@@ -1,154 +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.examples.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with task execution.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- * <p>
- * The example executes map-reduce task that accepts collection of portable objects as an argument.
- * Since these objects are never deserialized on remote nodes, classes are not required on classpath
- * of these nodes.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- * <p>
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class ComputeClientPortableTaskExecutionExample {
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) {
- try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
- System.out.println();
- System.out.println(">>> Portable objects task execution example started.");
-
- if (ignite.cluster().forRemotes().nodes().isEmpty()) {
- System.out.println();
- System.out.println(">>> This example requires remote nodes to be started.");
- System.out.println(">>> Please start at least 1 remote node.");
- System.out.println(">>> Refer to example's javadoc for details on configuration.");
- System.out.println();
-
- return;
- }
-
- // Generate employees to calculate average salary for.
- Collection<Employee> employees = employees();
-
- System.out.println();
- System.out.println(">>> Calculating average salary for employees:");
-
- for (Employee employee : employees)
- System.out.println(">>> " + employee);
-
- // Convert collection of employees to collection of portable objects.
- // This allows to send objects across nodes without requiring to have
- // Employee class on classpath of these nodes.
- Collection<PortableObject> portables = ignite.portables().toPortable(employees);
-
- // Execute task and get average salary.
- Long avgSalary = ignite.compute(ignite.cluster().forRemotes()).execute(new ComputeClientTask(), portables);
-
- System.out.println();
- System.out.println(">>> Average salary for all employees: " + avgSalary);
- System.out.println();
- }
- }
-
- /**
- * Creates collection of employees.
- *
- * @return Collection of employees.
- */
- private static Collection<Employee> employees() {
- Collection<Employee> employees = new ArrayList<>();
-
- employees.add(new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- Arrays.asList("Human Resources", "Customer Service")
- ));
-
- employees.add(new Employee(
- "Daniel Adams",
- 11000,
- new Address("184 Fidler Drive, San Antonio, TX", 78205),
- Arrays.asList("Development", "QA")
- ));
-
- employees.add(new Employee(
- "Cristian Moss",
- 12500,
- new Address("667 Jerry Dove Drive, Florence, SC", 29501),
- Arrays.asList("Logistics")
- ));
-
- employees.add(new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, Hornitos, CA", 95325),
- Arrays.asList("Development")
- ));
-
- employees.add(new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78758),
- Arrays.asList("Sales")
- ));
-
- employees.add(new Employee(
- "Philip Horsley",
- 19800,
- new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
- Arrays.asList("Sales")
- ));
-
- employees.add(new Employee(
- "Brian Peters",
- 10600,
- new Address("1407 Pearlman Avenue, Boston, MA", 12110),
- Arrays.asList("Development", "QA")
- ));
-
- employees.add(new Employee(
- "Jack Yang",
- 12900,
- new Address("4425 Parrish Avenue Smithsons Valley, TX", 78130),
- Arrays.asList("Sales")
- ));
-
- return employees;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
deleted file mode 100644
index 0eee8c6..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
+++ /dev/null
@@ -1,116 +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.examples.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.portable.PortableObject;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task that is used for {@link ComputeClientPortableTaskExecutionExample} and
- * similar examples in .NET and C++.
- * <p>
- * This task calculates average salary for provided collection of employees.
- * It splits the collection into batches of size {@code 3} and creates a job
- * for each batch. After all jobs are executed, there results are reduced to
- * get the average salary.
- */
-public class ComputeClientTask extends ComputeTaskSplitAdapter<Collection<PortableObject>, Long> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(
- int gridSize,
- Collection<PortableObject> arg
- ) {
- Collection<ComputeClientJob> jobs = new ArrayList<>();
-
- Collection<PortableObject> employees = new ArrayList<>();
-
- // Split provided collection into batches and
- // create a job for each batch.
- for (PortableObject employee : arg) {
- employees.add(employee);
-
- if (employees.size() == 3) {
- jobs.add(new ComputeClientJob(employees));
-
- employees = new ArrayList<>(3);
- }
- }
-
- if (!employees.isEmpty())
- jobs.add(new ComputeClientJob(employees));
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Long reduce(List<ComputeJobResult> results) {
- long sum = 0;
- int cnt = 0;
-
- for (ComputeJobResult res : results) {
- IgniteBiTuple<Long, Integer> t = res.getData();
-
- sum += t.get1();
- cnt += t.get2();
- }
-
- return sum / cnt;
- }
-
- /**
- * Remote job for {@link ComputeClientTask}.
- */
- private static class ComputeClientJob extends ComputeJobAdapter {
- /** Collection of employees. */
- private final Collection<PortableObject> employees;
-
- /**
- * @param employees Collection of employees.
- */
- private ComputeClientJob(Collection<PortableObject> employees) {
- this.employees = employees;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object execute() {
- long sum = 0;
- int cnt = 0;
-
- for (PortableObject employee : employees) {
- System.out.println(">>> Processing employee: " + employee.field("name"));
-
- // Get salary from portable object. Note that object
- // doesn't need to be fully deserialized.
- long salary = employee.field("salary");
-
- sum += salary;
- cnt++;
- }
-
- return new IgniteBiTuple<>(sum, cnt);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
deleted file mode 100644
index 469128c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Demonstrates the usage of portable objects with task execution.
- */
-package org.apache.ignite.examples.portable.computegrid;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
deleted file mode 100644
index 77c5d95..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
+++ /dev/null
@@ -1,230 +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.examples.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with Ignite cache.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- * <p>
- * The example executes several put-get operations on Ignite cache with portable values. Note that
- * it demonstrates how portable object can be retrieved in fully-deserialized form or in portable object
- * format using special cache projection.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- * <p>
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortablePutGetExample {
- /** Cache name. */
- private static final String CACHE_NAME = CacheClientPortablePutGetExample.class.getSimpleName();
-
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) {
- try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
- System.out.println();
- System.out.println(">>> Portable objects cache put-get example started.");
-
- CacheConfiguration<Integer, Organization> cfg = new CacheConfiguration<>();
-
- cfg.setCacheMode(CacheMode.PARTITIONED);
- cfg.setName(CACHE_NAME);
- cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-
- try (IgniteCache<Integer, Organization> cache = ignite.createCache(cfg)) {
- if (ignite.cluster().forDataNodes(cache.getName()).nodes().isEmpty()) {
- System.out.println();
- System.out.println(">>> This example requires remote cache node nodes to be started.");
- System.out.println(">>> Please start at least 1 remote cache node.");
- System.out.println(">>> Refer to example's javadoc for details on configuration.");
- System.out.println();
-
- return;
- }
-
- putGet(cache);
- putGetPortable(cache);
- putGetAll(cache);
- putGetAllPortable(cache);
-
- System.out.println();
- }
- finally {
- // Delete cache with its content completely.
- ignite.destroyCache(CACHE_NAME);
- }
- }
- }
-
- /**
- * Execute individual put and get.
- *
- * @param cache Cache.
- */
- private static void putGet(IgniteCache<Integer, Organization> cache) {
- // Create new Organization portable object to store in cache.
- Organization org = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- // Put created data entry to cache.
- cache.put(1, org);
-
- // Get recently created organization as a strongly-typed fully de-serialized instance.
- Organization orgFromCache = cache.get(1);
-
- System.out.println();
- System.out.println(">>> Retrieved organization instance from cache: " + orgFromCache);
- }
-
- /**
- * Execute individual put and get, getting value in portable format, without de-serializing it.
- *
- * @param cache Cache.
- */
- private static void putGetPortable(IgniteCache<Integer, Organization> cache) {
- // Create new Organization portable object to store in cache.
- Organization org = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- // Put created data entry to cache.
- cache.put(1, org);
-
- // Get cache that will get values as portable objects.
- IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();
-
- // Get recently created organization as a portable object.
- PortableObject po = portableCache.get(1);
-
- // Get organization's name from portable object (note that
- // object doesn't need to be fully deserialized).
- String name = po.field("name");
-
- System.out.println();
- System.out.println(">>> Retrieved organization name from portable object: " + name);
- }
-
- /**
- * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations.
- *
- * @param cache Cache.
- */
- private static void putGetAll(IgniteCache<Integer, Organization> cache) {
- // Create new Organization portable objects to store in cache.
- Organization org1 = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Organization org2 = new Organization(
- "Red Cross", // Name.
- new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
- OrganizationType.NON_PROFIT, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Map<Integer, Organization> map = new HashMap<>();
-
- map.put(1, org1);
- map.put(2, org2);
-
- // Put created data entries to cache.
- cache.putAll(map);
-
- // Get recently created organizations as a strongly-typed fully de-serialized instances.
- Map<Integer, Organization> mapFromCache = cache.getAll(map.keySet());
-
- System.out.println();
- System.out.println(">>> Retrieved organization instances from cache:");
-
- for (Organization org : mapFromCache.values())
- System.out.println(">>> " + org);
- }
-
- /**
- * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations,
- * getting values in portable format, without de-serializing it.
- *
- * @param cache Cache.
- */
- private static void putGetAllPortable(IgniteCache<Integer, Organization> cache) {
- // Create new Organization portable objects to store in cache.
- Organization org1 = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Organization org2 = new Organization(
- "Red Cross", // Name.
- new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
- OrganizationType.NON_PROFIT, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Map<Integer, Organization> map = new HashMap<>();
-
- map.put(1, org1);
- map.put(2, org2);
-
- // Put created data entries to cache.
- cache.putAll(map);
-
- // Get cache that will get values as portable objects.
- IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();
-
- // Get recently created organizations as portable objects.
- Map<Integer, PortableObject> poMap = portableCache.getAll(map.keySet());
-
- Collection<String> names = new ArrayList<>();
-
- // Get organizations' names from portable objects (note that
- // objects don't need to be fully deserialized).
- for (PortableObject po : poMap.values())
- names.add(po.<String>field("name"));
-
- System.out.println();
- System.out.println(">>> Retrieved organization names from portable objects: " + names);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
deleted file mode 100644
index 3170864..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
+++ /dev/null
@@ -1,325 +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.examples.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.TextQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.EmployeeKey;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with cache queries.
- * The example populates cache with sample data and runs several SQL and full text queries over this data.
- * <p>
- * Remote nodes should always be started with {@link ExamplePortableNodeStartup} which starts a node with
- * {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortableQueryExample {
- /** Organization cache name. */
- private static final String ORGANIZATION_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
- + "Organizations";
-
- /** Employee cache name. */
- private static final String EMPLOYEE_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
- + "Employees";
-
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) {
- try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
- System.out.println();
- System.out.println(">>> Portable objects cache query example started.");
-
- CacheConfiguration<Integer, Organization> orgCacheCfg = new CacheConfiguration<>();
-
- orgCacheCfg.setCacheMode(CacheMode.PARTITIONED);
- orgCacheCfg.setName(ORGANIZATION_CACHE_NAME);
-
- orgCacheCfg.setTypeMetadata(Arrays.asList(createOrganizationTypeMetadata()));
-
- CacheConfiguration<EmployeeKey, Employee> employeeCacheCfg = new CacheConfiguration<>();
-
- employeeCacheCfg.setCacheMode(CacheMode.PARTITIONED);
- employeeCacheCfg.setName(EMPLOYEE_CACHE_NAME);
-
- employeeCacheCfg.setTypeMetadata(Arrays.asList(createEmployeeTypeMetadata()));
-
- try (IgniteCache<Integer, Organization> orgCache = ignite.createCache(orgCacheCfg);
- IgniteCache<EmployeeKey, Employee> employeeCache = ignite.createCache(employeeCacheCfg)
- ) {
- if (ignite.cluster().forDataNodes(orgCache.getName()).nodes().isEmpty()) {
- System.out.println();
- System.out.println(">>> This example requires remote cache nodes to be started.");
- System.out.println(">>> Please start at least 1 remote cache node.");
- System.out.println(">>> Refer to example's javadoc for details on configuration.");
- System.out.println();
-
- return;
- }
-
- // Populate cache with sample data entries.
- populateCache(orgCache, employeeCache);
-
- // Get cache that will work with portable objects.
- IgniteCache<PortableObject, PortableObject> portableCache = employeeCache.withKeepPortable();
-
- // Run SQL query example.
- sqlQuery(portableCache);
-
- // Run SQL query with join example.
- sqlJoinQuery(portableCache);
-
- // Run SQL fields query example.
- sqlFieldsQuery(portableCache);
-
- // Run full text query example.
- textQuery(portableCache);
-
- System.out.println();
- }
- finally {
- // Delete caches with their content completely.
- ignite.destroyCache(ORGANIZATION_CACHE_NAME);
- ignite.destroyCache(EMPLOYEE_CACHE_NAME);
- }
- }
- }
-
- /**
- * Create cache type metadata for {@link Employee}.
- *
- * @return Cache type metadata.
- */
- private static CacheTypeMetadata createEmployeeTypeMetadata() {
- CacheTypeMetadata employeeTypeMeta = new CacheTypeMetadata();
-
- employeeTypeMeta.setValueType(Employee.class);
-
- employeeTypeMeta.setKeyType(EmployeeKey.class);
-
- Map<String, Class<?>> ascFields = new HashMap<>();
-
- ascFields.put("name", String.class);
- ascFields.put("salary", Long.class);
- ascFields.put("address.zip", Integer.class);
- ascFields.put("organizationId", Integer.class);
-
- employeeTypeMeta.setAscendingFields(ascFields);
-
- employeeTypeMeta.setTextFields(Arrays.asList("address.street"));
-
- return employeeTypeMeta;
- }
-
- /**
- * Create cache type metadata for {@link Organization}.
- *
- * @return Cache type metadata.
- */
- private static CacheTypeMetadata createOrganizationTypeMetadata() {
- CacheTypeMetadata organizationTypeMeta = new CacheTypeMetadata();
-
- organizationTypeMeta.setValueType(Organization.class);
-
- organizationTypeMeta.setKeyType(Integer.class);
-
- Map<String, Class<?>> ascFields = new HashMap<>();
-
- ascFields.put("name", String.class);
-
- Map<String, Class<?>> queryFields = new HashMap<>();
-
- queryFields.put("address.street", String.class);
-
- organizationTypeMeta.setAscendingFields(ascFields);
-
- organizationTypeMeta.setQueryFields(queryFields);
-
- return organizationTypeMeta;
- }
-
- /**
- * Queries employees that have provided ZIP code in address.
- *
- * @param cache Ignite cache.
- */
- private static void sqlQuery(IgniteCache<PortableObject, PortableObject> cache) {
- SqlQuery<PortableObject, PortableObject> query = new SqlQuery<>(Employee.class, "zip = ?");
-
- int zip = 94109;
-
- QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees = cache.query(query.setArgs(zip));
-
- System.out.println();
- System.out.println(">>> Employees with zip " + zip + ':');
-
- for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
- System.out.println(">>> " + e.getValue().deserialize());
- }
-
- /**
- * Queries employees that work for organization with provided name.
- *
- * @param cache Ignite cache.
- */
- private static void sqlJoinQuery(IgniteCache<PortableObject, PortableObject> cache) {
- SqlQuery<PortableObject, PortableObject> query = new SqlQuery<>(Employee.class,
- "from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
- "where Employee.organizationId = org._key and org.name = ?");
-
- String organizationName = "GridGain";
-
- QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees =
- cache.query(query.setArgs(organizationName));
-
- System.out.println();
- System.out.println(">>> Employees working for " + organizationName + ':');
-
- for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
- System.out.println(">>> " + e.getValue());
- }
-
- /**
- * Queries names and salaries for all employees.
- *
- * @param cache Ignite cache.
- */
- private static void sqlFieldsQuery(IgniteCache<PortableObject, PortableObject> cache) {
- SqlFieldsQuery query = new SqlFieldsQuery("select name, salary from Employee");
-
- QueryCursor<List<?>> employees = cache.query(query);
-
- System.out.println();
- System.out.println(">>> Employee names and their salaries:");
-
- for (List<?> row : employees.getAll())
- System.out.println(">>> [Name=" + row.get(0) + ", salary=" + row.get(1) + ']');
- }
-
- /**
- * Queries employees that live in Texas using full-text query API.
- *
- * @param cache Ignite cache.
- */
- private static void textQuery(IgniteCache<PortableObject, PortableObject> cache) {
- TextQuery<PortableObject, PortableObject> query = new TextQuery<>(Employee.class, "TX");
-
- QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees = cache.query(query);
-
- System.out.println();
- System.out.println(">>> Employees living in Texas:");
-
- for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
- System.out.println(">>> " + e.getValue().deserialize());
- }
-
- /**
- * Populates cache with data.
- *
- * @param orgCache Organization cache.
- * @param employeeCache Employee cache.
- */
- private static void populateCache(IgniteCache<Integer, Organization> orgCache,
- IgniteCache<EmployeeKey, Employee> employeeCache) {
- orgCache.put(1, new Organization(
- "GridGain",
- new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
- OrganizationType.PRIVATE,
- new Timestamp(System.currentTimeMillis())
- ));
-
- orgCache.put(2, new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.PRIVATE,
- new Timestamp(System.currentTimeMillis())
- ));
-
- employeeCache.put(new EmployeeKey(1, 1), new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- Arrays.asList("Human Resources", "Customer Service")
- ));
-
- employeeCache.put(new EmployeeKey(2, 1), new Employee(
- "Daniel Adams",
- 11000,
- new Address("184 Fidler Drive, San Antonio, TX", 78130),
- Arrays.asList("Development", "QA")
- ));
-
- employeeCache.put(new EmployeeKey(3, 1), new Employee(
- "Cristian Moss",
- 12500,
- new Address("667 Jerry Dove Drive, Florence, SC", 29501),
- Arrays.asList("Logistics")
- ));
-
- employeeCache.put(new EmployeeKey(4, 2), new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, San Francisco, CA", 94109),
- Arrays.asList("Development")
- ));
-
- employeeCache.put(new EmployeeKey(5, 2), new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78130),
- Arrays.asList("Sales")
- ));
-
- employeeCache.put(new EmployeeKey(6, 2), new Employee(
- "Philip Horsley",
- 19800,
- new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
- Arrays.asList("Sales")
- ));
-
- employeeCache.put(new EmployeeKey(7, 2), new Employee(
- "Brian Peters",
- 10600,
- new Address("1407 Pearlman Avenue, Boston, MA", 12110),
- Arrays.asList("Development", "QA")
- ));
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
deleted file mode 100644
index b24f233..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Demonstrates the usage of portable objects with cache.
- */
-package org.apache.ignite.examples.portable.datagrid;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
deleted file mode 100644
index 4301027..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains portable classes and examples.
- */
-package org.apache.ignite.examples.portable;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
deleted file mode 100644
index 6ea1484..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
+++ /dev/null
@@ -1,46 +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.examples;
-
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortablePutGetExample;
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortableQueryExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- *
- */
-public class CacheClientPortableExampleTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/portable/example-ignite-portable.xml";
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortablePutGetExample() throws Exception {
- CacheClientPortablePutGetExample.main(new String[] {});
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableQueryExample() throws Exception {
- CacheClientPortableQueryExample.main(new String[] {});
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
deleted file mode 100644
index 2223aec..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
+++ /dev/null
@@ -1,37 +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.examples;
-
-import org.apache.ignite.examples.portable.computegrid.ComputeClientPortableTaskExecutionExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- *
- */
-public class ComputeClientPortableExampleTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/portable/example-ignite-portable.xml";
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableTaskExecutionExample() throws Exception {
- ComputeClientPortableTaskExecutionExample.main(new String[] {});
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
index baa23fc..4669ae4 100644
--- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
+++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
@@ -20,12 +20,10 @@ package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
import org.apache.ignite.examples.BasicExamplesMultiNodeSelfTest;
import org.apache.ignite.examples.BasicExamplesSelfTest;
-import org.apache.ignite.examples.CacheClientPortableExampleTest;
import org.apache.ignite.examples.CacheExamplesMultiNodeSelfTest;
import org.apache.ignite.examples.CacheExamplesSelfTest;
import org.apache.ignite.examples.CheckpointExamplesSelfTest;
import org.apache.ignite.examples.ClusterGroupExampleSelfTest;
-import org.apache.ignite.examples.ComputeClientPortableExampleTest;
import org.apache.ignite.examples.ContinuationExamplesMultiNodeSelfTest;
import org.apache.ignite.examples.ContinuationExamplesSelfTest;
import org.apache.ignite.examples.ContinuousMapperExamplesMultiNodeSelfTest;
@@ -95,10 +93,6 @@ public class IgniteExamplesSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(MonteCarloExamplesMultiNodeSelfTest.class));
suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
- // Portable.
- suite.addTest(new TestSuite(CacheClientPortableExampleTest.class));
- suite.addTest(new TestSuite(ComputeClientPortableExampleTest.class));
-
return suite;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 2f0dde7..9162afe 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -34,13 +34,6 @@
<version>1.4.0-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <repositories>
- <repository>
- <id>ignite-portables-test-repo</id>
- <url>file://${basedir}/src/test/portables/repo</url>
- </repository>
- </repositories>
-
<properties>
<ignite.update.notifier.product>apache-ignite</ignite.update.notifier.product>
</properties>
@@ -176,20 +169,6 @@
<version>2.4</version>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.ignite.portable</groupId>
- <artifactId>test1</artifactId>
- <version>1.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite.portable</groupId>
- <artifactId>test2</artifactId>
- <version>1.1</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 62fd020..0afccd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -459,13 +459,6 @@ public interface Ignite extends AutoCloseable {
public <T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException;
/**
- * Gets an instance of {@link IgnitePortables} interface.
- *
- * @return Instance of {@link IgnitePortables} interface.
- */
- public IgnitePortables portables();
-
- /**
* Closes {@code this} instance of grid. This method is identical to calling
* {@link G#stop(String, boolean) G.stop(gridName, true)}.
* <p>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index e0f9f55..5558a26 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -18,12 +18,9 @@
package org.apache.ignite;
import java.io.Serializable;
-import java.sql.Timestamp;
import java.util.Collection;
-import java.util.Date;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import javax.cache.Cache;
@@ -55,7 +52,6 @@ import org.apache.ignite.lang.IgniteAsyncSupported;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
import org.apache.ignite.mxbean.CacheMetricsMXBean;
import org.jetbrains.annotations.Nullable;
@@ -132,44 +128,6 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public IgniteCache<K, V> withNoRetries();
/**
- * Returns cache that will operate with portable objects.
- * <p>
- * Cache returned by this method will not be forced to deserialize portable objects,
- * so keys and values will be returned from cache API methods without changes. Therefore,
- * signature of the cache can contain only following types:
- * <ul>
- * <li><code>org.apache.ignite.portable.PortableObject</code> for portable classes</li>
- * <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
- * <li>Arrays of primitives (byte[], int[], ...)</li>
- * <li>{@link String} and array of {@link String}s</li>
- * <li>{@link UUID} and array of {@link UUID}s</li>
- * <li>{@link Date} and array of {@link Date}s</li>
- * <li>{@link Timestamp} and array of {@link Timestamp}s</li>
- * <li>Enums and array of enums</li>
- * <li>
- * Maps, collections and array of objects (but objects inside
- * them will still be converted if they are portable)
- * </li>
- * </ul>
- * <p>
- * For example, if you use {@link Integer} as a key and {@code Value} class as a value
- * (which will be stored in portable format), you should acquire following projection
- * to avoid deserialization:
- * <pre>
- * IgniteCache<Integer, PortableObject> prj = cache.withKeepPortable();
- *
- * // Value is not deserialized and returned in portable format.
- * PortableObject po = prj.get(1);
- * </pre>
- * <p>
- * Note that this method makes sense only if cache is working in portable mode ({@link PortableMarshaller} is used).
- * If not, this method is no-op and will return current cache.
- *
- * @return New cache instance for portable objects.
- */
- public <K1, V1> IgniteCache<K1, V1> withKeepPortable();
-
- /**
* Executes {@link #localLoadCache(IgniteBiPredicate, Object...)} on all cache nodes.
*
* @param p Optional predicate (may be {@code null}). If provided, will be used to
@@ -661,4 +619,4 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
* @return MxBean.
*/
public CacheMetricsMXBean mxBean();
-}
\ No newline at end of file
+}
[12/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
deleted file mode 100644
index ee0a4ec..0000000
--- a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
+++ /dev/null
@@ -1,370 +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;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.TreeMap;
-import java.util.UUID;
-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.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Defines portable objects functionality. With portable objects you are able to:
- * <ul>
- * <li>Seamlessly interoperate between Java, .NET, and C++.</li>
- * <li>Make any object portable with zero code change to your existing code.</li>
- * <li>Nest portable objects within each other.</li>
- * <li>Automatically handle {@code circular} or {@code null} references.</li>
- * <li>Automatically convert collections and maps between Java, .NET, and C++.</li>
- * <li>
- * Optionally avoid deserialization of objects on the server side
- * (objects are stored in {@link PortableObject} format).
- * </li>
- * <li>Avoid need to have concrete class definitions on the server side.</li>
- * <li>Dynamically change structure of the classes without having to restart the cluster.</li>
- * <li>Index into portable objects for querying purposes.</li>
- * </ul>
- * <h1 class="header">Working With Portables Directly</h1>
- * Once an object is defined as portable,
- * Ignite will always store it in memory in the portable (i.e. binary) format.
- * User can choose to work either with the portable format or with the deserialized form
- * (assuming that class definitions are present in the classpath).
- * <p>
- * To work with the portable format directly, user should create a special cache projection
- * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
- * <pre name=code class=java>
- * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
- *
- * // Convert instance of MyKey to portable format.
- * // We could also use PortableBuilder to create the key in portable format directly.
- * PortableObject key = grid.portables().toPortable(new MyKey());
- *
- * PortableObject val = prj.get(key);
- *
- * String field = val.field("myFieldName");
- * </pre>
- * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
- * <pre name=code class=java>
- * IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null);
- *
- * MyValue val = cache.get(new MyKey());
- *
- * // Normal java getter.
- * String fieldVal = val.getMyFieldName();
- * </pre>
- * If we used, for example, one of the automatically handled portable types for a key, like integer,
- * and still wanted to work with binary portable format for values, then we would declare cache projection
- * as follows:
- * <pre name=code class=java>
- * IgniteCache<Integer.class, PortableObject> prj = cache.withKeepPortable();
- * </pre>
- * <h1 class="header">Automatic Portable Types</h1>
- * Note that only portable classes are converted to {@link PortableObject} format. Following
- * classes are never converted (e.g., {@link #toPortable(Object)} method will return original
- * object, and instances of these classes will be stored in cache without changes):
- * <ul>
- * <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
- * <li>Arrays of primitives (byte[], int[], ...)</li>
- * <li>{@link String} and array of {@link String}s</li>
- * <li>{@link UUID} and array of {@link UUID}s</li>
- * <li>{@link Date} and array of {@link Date}s</li>
- * <li>{@link Timestamp} and array of {@link Timestamp}s</li>
- * <li>Enums and array of enums</li>
- * <li>
- * Maps, collections and array of objects (but objects inside
- * them will still be converted if they are portable)
- * </li>
- * </ul>
- * <h1 class="header">Working With Maps and Collections</h1>
- * All maps and collections in the portable objects are serialized automatically. When working
- * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
- * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
- * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
- * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
- * in C#, etc.
- * <h1 class="header">Building Portable Objects</h1>
- * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder();
- *
- * builder.typeId("MyObject");
- *
- * builder.stringField("fieldA", "A");
- * build.intField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- * </pre>
- * For the cases when class definition is present
- * in the class path, it is also possible to populate a standard POJO and then
- * convert it to portable format, like so:
- * <pre name=code class=java>
- * MyObject obj = new MyObject();
- *
- * obj.setFieldA("A");
- * obj.setFieldB(123);
- *
- * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
- * </pre>
- * NOTE: you don't need to convert typed objects to portable format before storing
- * them in cache, Ignite will do that automatically.
- * <h1 class="header">Portable Metadata</h1>
- * Even though Ignite portable protocol only works with hash codes for type and field names
- * to achieve better performance, Ignite provides metadata for all portable types which
- * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
- * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- * <h1 class="header">Dynamic Structure Changes</h1>
- * Since objects are always cached in the portable binary format, server does not need to
- * be aware of the class definitions. Moreover, if class definitions are not present or not
- * used on the server, then clients can continuously change the structure of the portable
- * objects without having to restart the cluster. For example, if one client stores a
- * certain class with fields A and B, and another client stores the same class with
- * fields B and C, then the server-side portable object will have the fields A, B, and C.
- * As the structure of a portable object changes, the new fields become available for SQL queries
- * automatically.
- * <h1 class="header">Configuration</h1>
- * By default all your objects are considered as portables and no specific configuration is needed.
- * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
- * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
- * The only requirement Ignite imposes is that your object has an empty
- * constructor. Note, that since server side does not have to know the class definition,
- * you only need to list portable objects in configuration on the client side. However, if you
- * list them on the server side as well, then you get the ability to deserialize portable objects
- * into concrete types on the server as well as on the client.
- * <p>
- * Here is an example of portable configuration (note that star (*) notation is supported):
- * <pre name=code class=xml>
- * ...
- * <!-- Explicit portable objects configuration. -->
- * <property name="marshaller">
- * <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
- * <property name="classNames">
- * <list>
- * <value>my.package.for.portable.objects.*</value>
- * <value>org.apache.ignite.examples.client.portable.Employee</value>
- * </list>
- * </property>
- * </bean>
- * </property>
- * ...
- * </pre>
- * or from code:
- * <pre name=code class=java>
- * IgniteConfiguration cfg = new IgniteConfiguration();
- *
- * PortableMarshaller marsh = new PortableMarshaller();
- *
- * marsh.setClassNames(Arrays.asList(
- * Employee.class.getName(),
- * Address.class.getName())
- * );
- *
- * cfg.setMarshaller(marsh);
- * </pre>
- * You can also specify class name for a portable object via {@link PortableTypeConfiguration}.
- * Do it in case if you need to override other configuration properties on per-type level, like
- * ID-mapper, or serializer.
- * <h1 class="header">Custom Affinity Keys</h1>
- * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
- * storing objects in cache. For example, if you are caching {@code Employee} object with
- * {@code Organization}, and want to colocate employees with organization they work for,
- * so you can process them together, you need to specify an alternate affinity key.
- * With portable objects you would have to do it as following:
- * <pre name=code class=xml>
- * <property name="marshaller">
- * <bean class="org.gridgain.grid.marshaller.portable.PortableMarshaller">
- * ...
- * <property name="typeConfigurations">
- * <list>
- * <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
- * <property name="className" value="org.apache.ignite.examples.client.portable.EmployeeKey"/>
- * <property name="affinityKeyFieldName" value="organizationId"/>
- * </bean>
- * </list>
- * </property>
- * ...
- * </bean>
- * </property>
- * </pre>
- * <h1 class="header">Serialization</h1>
- * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
- * serialization logic by optionally implementing {@link PortableMarshalAware} interface, like so:
- * <pre name=code class=java>
- * public class Address implements PortableMarshalAware {
- * private String street;
- * private int zip;
- *
- * // Empty constructor required for portable deserialization.
- * public Address() {}
- *
- * @Override public void writePortable(PortableWriter writer) throws PortableException {
- * writer.writeString("street", street);
- * writer.writeInt("zip", zip);
- * }
- *
- * @Override public void readPortable(PortableReader reader) throws PortableException {
- * street = reader.readString("street");
- * zip = reader.readInt("zip");
- * }
- * }
- * </pre>
- * Alternatively, if you cannot change class definitions, you can provide custom serialization
- * logic in {@link PortableSerializer} either globally in {@link PortableMarshaller} or
- * for a specific type via {@link PortableTypeConfiguration} instance.
- * <p>
- * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
- * <ul>
- * <li>
- * {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
- * It may be used to replace the de-serialized object by another one of your choice.
- * </li>
- * <li>
- * {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
- * allows the developer to provide a replacement object that will be serialized instead of the original one.
- * </li>
- * </ul>
- *
- * <h1 class="header">Custom ID Mappers</h1>
- * Ignite implementation uses name hash codes to generate IDs for class names or field names
- * internally. However, in cases when you want to provide your own ID mapping schema,
- * you can provide your own {@link PortableIdMapper} implementation.
- * <p>
- * ID-mapper may be provided either globally in {@link PortableMarshaller},
- * or for a specific type via {@link PortableTypeConfiguration} instance.
- * <h1 class="header">Query Indexing</h1>
- * Portable objects can be indexed for querying by specifying index fields in
- * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
- * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
- * like so:
- * <pre name=code class=xml>
- * ...
- * <bean class="org.apache.ignite.cache.CacheConfiguration">
- * ...
- * <property name="typeMetadata">
- * <list>
- * <bean class="CacheTypeMetadata">
- * <property name="type" value="Employee"/>
- *
- * <!-- Fields to index in ascending order. -->
- * <property name="ascendingFields">
- * <map>
- * <entry key="name" value="java.lang.String"/>
- *
- * <!-- Nested portable objects can also be indexed. -->
- * <entry key="address.zip" value="java.lang.Integer"/>
- * </map>
- * </property>
- * </bean>
- * </list>
- * </property>
- * </bean>
- * </pre>
- */
-public interface IgnitePortables {
- /**
- * Gets type ID for given type name.
- *
- * @param typeName Type name.
- * @return Type ID.
- */
- public int typeId(String typeName);
-
- /**
- * Converts provided object to instance of {@link PortableObject}.
- *
- * @param obj Object to convert.
- * @return Converted object.
- * @throws PortableException In case of error.
- */
- public <T> T toPortable(@Nullable Object obj) throws PortableException;
-
- /**
- * Creates new portable builder.
- *
- * @param typeId ID of the type.
- * @return Newly portable builder.
- */
- public PortableBuilder builder(int typeId);
-
- /**
- * Creates new portable builder.
- *
- * @param typeName Type name.
- * @return Newly portable builder.
- */
- public PortableBuilder builder(String typeName);
-
- /**
- * Creates portable builder initialized by existing portable object.
- *
- * @param portableObj Portable object to initialize builder.
- * @return Portable builder.
- */
- public PortableBuilder builder(PortableObject portableObj);
-
- /**
- * Gets metadata for provided class.
- *
- * @param cls Class.
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metadata(Class<?> cls) throws PortableException;
-
- /**
- * Gets metadata for provided class name.
- *
- * @param typeName Type name.
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metadata(String typeName) throws PortableException;
-
- /**
- * Gets metadata for provided type ID.
- *
- * @param typeId Type ID.
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metadata(int typeId) throws PortableException;
-
- /**
- * Gets metadata for all known types.
- *
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- public Collection<PortableMetadata> metadata() throws PortableException;
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 9fb56bc..7d1e14d 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -17,10 +17,24 @@
package org.apache.ignite.configuration;
+import java.io.Serializable;
+import java.util.Collection;
+import javax.cache.Cache;
+import javax.cache.configuration.CompleteConfiguration;
+import javax.cache.configuration.Factory;
+import javax.cache.configuration.MutableConfiguration;
+import javax.cache.expiry.ExpiryPolicy;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cache.CacheInterceptor;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityKeyMapper;
import org.apache.ignite.cache.eviction.EvictionFilter;
@@ -36,15 +50,6 @@ import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.plugin.CachePluginConfiguration;
import org.jetbrains.annotations.Nullable;
-import javax.cache.Cache;
-import javax.cache.CacheException;
-import javax.cache.configuration.CompleteConfiguration;
-import javax.cache.configuration.Factory;
-import javax.cache.configuration.MutableConfiguration;
-import javax.cache.expiry.ExpiryPolicy;
-import java.io.Serializable;
-import java.util.Collection;
-
/**
* This class defines grid cache configuration. This configuration is passed to
* grid via {@link IgniteConfiguration#getCacheConfiguration()} method. It defines all configuration
@@ -163,10 +168,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/** Default size for onheap SQL row cache size. */
public static final int DFLT_SQL_ONHEAP_ROW_CACHE_SIZE = 10 * 1024;
- /** Default value for keep portable in store behavior .*/
- @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"})
- public static final Boolean DFLT_KEEP_PORTABLE_IN_STORE = new Boolean(true);
-
/** Cache name. */
private String name;
@@ -219,9 +220,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
private Factory storeFactory;
/** */
- private Boolean keepPortableInStore = DFLT_KEEP_PORTABLE_IN_STORE;
-
- /** */
private boolean loadPrevVal = DFLT_LOAD_PREV_VAL;
/** Node group resolver. */
@@ -383,8 +381,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
invalidate = cc.isInvalidate();
isReadThrough = cc.isReadThrough();
isWriteThrough = cc.isWriteThrough();
- keepPortableInStore = cc.isKeepPortableInStore() != null ? cc.isKeepPortableInStore() :
- DFLT_KEEP_PORTABLE_IN_STORE;
listenerConfigurations = cc.listenerConfigurations;
loadPrevVal = cc.isLoadPreviousValue();
longQryWarnTimeout = cc.getLongQueryWarningTimeout();
@@ -825,38 +821,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
- * Flag indicating that {@link CacheStore} implementation
- * is working with portable objects instead of Java objects.
- * Default value of this flag is {@link #DFLT_KEEP_PORTABLE_IN_STORE},
- * because this is recommended behavior from performance standpoint.
- * <p>
- * If set to {@code false}, Ignite will deserialize keys and
- * values stored in portable format before they are passed
- * to cache store.
- * <p>
- * Note that setting this flag to {@code false} can simplify
- * store implementation in some cases, but it can cause performance
- * degradation due to additional serializations and deserializations
- * of portable objects. You will also need to have key and value
- * classes on all nodes since portables will be deserialized when
- * store is called.
- *
- * @return Keep portables in store flag.
- */
- public Boolean isKeepPortableInStore() {
- return keepPortableInStore;
- }
-
- /**
- * Sets keep portables in store flag.
- *
- * @param keepPortableInStore Keep portables in store flag.
- */
- public void setKeepPortableInStore(boolean keepPortableInStore) {
- this.keepPortableInStore = keepPortableInStore;
- }
-
- /**
* Gets key topology resolver to provide mapping from keys to nodes.
*
* @return Key topology resolver to provide mapping from keys to nodes.
@@ -1860,4 +1824,4 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
return obj.getClass().equals(this.getClass());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index e3859c5..9443f21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal;
import java.util.Collection;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.cluster.IgniteClusterEx;
import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
@@ -140,4 +141,12 @@ public interface IgniteEx extends Ignite {
* @return Kernal context.
*/
public GridKernalContext context();
+
+
+ /**
+ * Gets an instance of {@link IgnitePortables} interface.
+ *
+ * @return Instance of {@link IgnitePortables} interface.
+ */
+ public IgnitePortables portables();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 9b615b1..abab1f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -64,7 +64,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteScheduler;
import org.apache.ignite.IgniteServices;
@@ -157,7 +157,7 @@ import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -203,7 +203,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
@@ -1270,9 +1269,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
add(ATTR_USER_NAME, System.getProperty("user.name"));
add(ATTR_GRID_NAME, gridName);
- add(ATTR_PORTABLE_PROTO_VER, cfg.getMarshaller() instanceof PortableMarshaller ?
- ((PortableMarshaller)cfg.getMarshaller()).getProtocolVersion().toString() :
- PortableMarshaller.DFLT_PORTABLE_PROTO_VER.toString());
add(ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
add(ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 7be2af3..10b8df0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -135,13 +135,10 @@ public final class IgniteNodeAttributes {
/** Node consistent id. */
public static final String ATTR_NODE_CONSISTENT_ID = ATTR_PREFIX + ".consistent.id";
- /** Portable protocol version. */
- public static final String ATTR_PORTABLE_PROTO_VER = ATTR_PREFIX + ".portable.proto.ver";
-
/**
* Enforces singleton.
*/
private IgniteNodeAttributes() {
/* No-op. */
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index bc4f756..3a09b2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -125,7 +125,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
import static org.apache.ignite.internal.IgniteVersionUtils.VER;
import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.NOOP;
@@ -982,8 +981,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
// Fetch local node attributes once.
String locPreferIpV4 = locNode.attribute("java.net.preferIPv4Stack");
- String locPortableProtoVer = locNode.attribute(ATTR_PORTABLE_PROTO_VER);
-
Object locMode = locNode.attribute(ATTR_DEPLOYMENT_MODE);
int locJvmMajVer = nodeJavaMajorVersion(locNode);
@@ -1033,13 +1030,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
", rmtId8=" + U.id8(n.id()) + ", rmtPeerClassLoading=" + rmtP2pEnabled +
", rmtAddrs=" + U.addressesAsString(n) + ']');
}
-
- String rmtPortableProtoVer = n.attribute(ATTR_PORTABLE_PROTO_VER);
-
- // In order to support backward compatibility skip the check for nodes that don't have this attribute.
- if (rmtPortableProtoVer != null && !F.eq(locPortableProtoVer, rmtPortableProtoVer))
- throw new IgniteCheckedException("Remote node has portable protocol version different from local " +
- "[locVersion=" + locPortableProtoVer + ", rmtVersion=" + rmtPortableProtoVer + ']');
}
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
index c7a9e6f..4bc8545 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.portable;
import org.apache.ignite.internal.portable.streams.PortableInputStream;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
index a2b4b74..e1b7324 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
@@ -40,11 +40,11 @@ import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
import org.jetbrains.annotations.Nullable;
import static java.lang.reflect.Modifier.isStatic;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 165ad9a..2ee96b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -60,16 +60,16 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfiguration;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetPortableConfiguration;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetPortableTypeConfiguration;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
index ae5fbf0..05e7f20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
@@ -27,9 +27,9 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
index e03d67f..fafafad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.portable;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
/**
* Portable meta data handler.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
index 1d26007..c0423eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
@@ -27,13 +27,13 @@ import java.util.Map;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
index fe4b628..229c90f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
@@ -23,9 +23,9 @@ import java.util.IdentityHashMap;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index 47ff1ab..cb81efe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -34,9 +34,9 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index ba8ee83..e788422 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -30,9 +30,9 @@ import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import sun.misc.Unsafe;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
index e703f2f..e401142 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.portable;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
index a59f157..43b7650 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
@@ -18,8 +18,8 @@
package org.apache.ignite.internal.portable;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
index 2d4a1c3..2537926 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable;
import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index 4ad125a..a101db5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -45,11 +45,11 @@ import org.apache.ignite.internal.util.GridEnumCache;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableReader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 7259cc9..ccc1a5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.ignite.internal.portable.builder.PortableLazyValue;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
index 3152c4b..1d5ca60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
@@ -18,12 +18,8 @@
package org.apache.ignite.internal.portable;
import java.io.IOException;
-import java.io.ObjectInputStream;
import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
@@ -32,14 +28,13 @@ import java.util.Date;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.portable.streams.PortableHeapOutputStream;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
import static java.nio.charset.StandardCharsets.UTF_8;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
new file mode 100644
index 0000000..56f3768
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
@@ -0,0 +1,362 @@
+/*
+ * 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.api;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import java.util.UUID;
+import org.apache.ignite.IgniteCache;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Defines portable objects functionality. With portable objects you are able to:
+ * <ul>
+ * <li>Seamlessly interoperate between Java, .NET, and C++.</li>
+ * <li>Make any object portable with zero code change to your existing code.</li>
+ * <li>Nest portable objects within each other.</li>
+ * <li>Automatically handle {@code circular} or {@code null} references.</li>
+ * <li>Automatically convert collections and maps between Java, .NET, and C++.</li>
+ * <li>
+ * Optionally avoid deserialization of objects on the server side
+ * (objects are stored in {@link PortableObject} format).
+ * </li>
+ * <li>Avoid need to have concrete class definitions on the server side.</li>
+ * <li>Dynamically change structure of the classes without having to restart the cluster.</li>
+ * <li>Index into portable objects for querying purposes.</li>
+ * </ul>
+ * <h1 class="header">Working With Portables Directly</h1>
+ * Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ * <p>
+ * To work with the portable format directly, user should create a special cache projection
+ * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
+ * <pre name=code class=java>
+ * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use PortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.portables().toPortable(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ * </pre>
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ * <pre name=code class=java>
+ * IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null);
+ *
+ * MyValue val = cache.get(new MyKey());
+ *
+ * // Normal java getter.
+ * String fieldVal = val.getMyFieldName();
+ * </pre>
+ * If we used, for example, one of the automatically handled portable types for a key, like integer,
+ * and still wanted to work with binary portable format for values, then we would declare cache projection
+ * as follows:
+ * <pre name=code class=java>
+ * IgniteCache<Integer.class, PortableObject> prj = cache.withKeepPortable();
+ * </pre>
+ * <h1 class="header">Automatic Portable Types</h1>
+ * Note that only portable classes are converted to {@link PortableObject} format. Following
+ * classes are never converted (e.g., {@link #toPortable(Object)} method will return original
+ * object, and instances of these classes will be stored in cache without changes):
+ * <ul>
+ * <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
+ * <li>Arrays of primitives (byte[], int[], ...)</li>
+ * <li>{@link String} and array of {@link String}s</li>
+ * <li>{@link UUID} and array of {@link UUID}s</li>
+ * <li>{@link Date} and array of {@link Date}s</li>
+ * <li>{@link Timestamp} and array of {@link Timestamp}s</li>
+ * <li>Enums and array of enums</li>
+ * <li>
+ * Maps, collections and array of objects (but objects inside
+ * them will still be converted if they are portable)
+ * </li>
+ * </ul>
+ * <h1 class="header">Working With Maps and Collections</h1>
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ * <h1 class="header">Building Portable Objects</h1>
+ * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder();
+ *
+ * builder.typeId("MyObject");
+ *
+ * builder.stringField("fieldA", "A");
+ * build.intField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ * <pre name=code class=java>
+ * MyObject obj = new MyObject();
+ *
+ * obj.setFieldA("A");
+ * obj.setFieldB(123);
+ *
+ * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
+ * </pre>
+ * NOTE: you don't need to convert typed objects to portable format before storing
+ * them in cache, Ignite will do that automatically.
+ * <h1 class="header">Portable Metadata</h1>
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ * <h1 class="header">Dynamic Structure Changes</h1>
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ * <h1 class="header">Configuration</h1>
+ * By default all your objects are considered as portables and no specific configuration is needed.
+ * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
+ * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
+ * The only requirement Ignite imposes is that your object has an empty
+ * constructor. Note, that since server side does not have to know the class definition,
+ * you only need to list portable objects in configuration on the client side. However, if you
+ * list them on the server side as well, then you get the ability to deserialize portable objects
+ * into concrete types on the server as well as on the client.
+ * <p>
+ * Here is an example of portable configuration (note that star (*) notation is supported):
+ * <pre name=code class=xml>
+ * ...
+ * <!-- Explicit portable objects configuration. -->
+ * <property name="marshaller">
+ * <bean class="org.apache.ignite.internal.portable.api.PortableMarshaller">
+ * <property name="classNames">
+ * <list>
+ * <value>my.package.for.portable.objects.*</value>
+ * <value>org.apache.ignite.examples.client.portable.Employee</value>
+ * </list>
+ * </property>
+ * </bean>
+ * </property>
+ * ...
+ * </pre>
+ * or from code:
+ * <pre name=code class=java>
+ * IgniteConfiguration cfg = new IgniteConfiguration();
+ *
+ * PortableMarshaller marsh = new PortableMarshaller();
+ *
+ * marsh.setClassNames(Arrays.asList(
+ * Employee.class.getName(),
+ * Address.class.getName())
+ * );
+ *
+ * cfg.setMarshaller(marsh);
+ * </pre>
+ * You can also specify class name for a portable object via {@link PortableTypeConfiguration}.
+ * Do it in case if you need to override other configuration properties on per-type level, like
+ * ID-mapper, or serializer.
+ * <h1 class="header">Custom Affinity Keys</h1>
+ * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
+ * storing objects in cache. For example, if you are caching {@code Employee} object with
+ * {@code Organization}, and want to colocate employees with organization they work for,
+ * so you can process them together, you need to specify an alternate affinity key.
+ * With portable objects you would have to do it as following:
+ * <pre name=code class=xml>
+ * <property name="marshaller">
+ * <bean class="org.gridgain.grid.marshaller.portable.PortableMarshaller">
+ * ...
+ * <property name="typeConfigurations">
+ * <list>
+ * <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
+ * <property name="className" value="org.apache.ignite.examples.client.portable.EmployeeKey"/>
+ * <property name="affinityKeyFieldName" value="organizationId"/>
+ * </bean>
+ * </list>
+ * </property>
+ * ...
+ * </bean>
+ * </property>
+ * </pre>
+ * <h1 class="header">Serialization</h1>
+ * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
+ * serialization logic by optionally implementing {@link PortableMarshalAware} interface, like so:
+ * <pre name=code class=java>
+ * public class Address implements PortableMarshalAware {
+ * private String street;
+ * private int zip;
+ *
+ * // Empty constructor required for portable deserialization.
+ * public Address() {}
+ *
+ * @Override public void writePortable(PortableWriter writer) throws PortableException {
+ * writer.writeString("street", street);
+ * writer.writeInt("zip", zip);
+ * }
+ *
+ * @Override public void readPortable(PortableReader reader) throws PortableException {
+ * street = reader.readString("street");
+ * zip = reader.readInt("zip");
+ * }
+ * }
+ * </pre>
+ * Alternatively, if you cannot change class definitions, you can provide custom serialization
+ * logic in {@link PortableSerializer} either globally in {@link PortableMarshaller} or
+ * for a specific type via {@link PortableTypeConfiguration} instance.
+ * <p>
+ * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
+ * <ul>
+ * <li>
+ * {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
+ * It may be used to replace the de-serialized object by another one of your choice.
+ * </li>
+ * <li>
+ * {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
+ * allows the developer to provide a replacement object that will be serialized instead of the original one.
+ * </li>
+ * </ul>
+ *
+ * <h1 class="header">Custom ID Mappers</h1>
+ * Ignite implementation uses name hash codes to generate IDs for class names or field names
+ * internally. However, in cases when you want to provide your own ID mapping schema,
+ * you can provide your own {@link PortableIdMapper} implementation.
+ * <p>
+ * ID-mapper may be provided either globally in {@link PortableMarshaller},
+ * or for a specific type via {@link PortableTypeConfiguration} instance.
+ * <h1 class="header">Query Indexing</h1>
+ * Portable objects can be indexed for querying by specifying index fields in
+ * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
+ * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
+ * like so:
+ * <pre name=code class=xml>
+ * ...
+ * <bean class="org.apache.ignite.cache.CacheConfiguration">
+ * ...
+ * <property name="typeMetadata">
+ * <list>
+ * <bean class="CacheTypeMetadata">
+ * <property name="type" value="Employee"/>
+ *
+ * <!-- Fields to index in ascending order. -->
+ * <property name="ascendingFields">
+ * <map>
+ * <entry key="name" value="java.lang.String"/>
+ *
+ * <!-- Nested portable objects can also be indexed. -->
+ * <entry key="address.zip" value="java.lang.Integer"/>
+ * </map>
+ * </property>
+ * </bean>
+ * </list>
+ * </property>
+ * </bean>
+ * </pre>
+ */
+public interface IgnitePortables {
+ /**
+ * Gets type ID for given type name.
+ *
+ * @param typeName Type name.
+ * @return Type ID.
+ */
+ public int typeId(String typeName);
+
+ /**
+ * Converts provided object to instance of {@link PortableObject}.
+ *
+ * @param obj Object to convert.
+ * @return Converted object.
+ * @throws PortableException In case of error.
+ */
+ public <T> T toPortable(@Nullable Object obj) throws PortableException;
+
+ /**
+ * Creates new portable builder.
+ *
+ * @param typeId ID of the type.
+ * @return Newly portable builder.
+ */
+ public PortableBuilder builder(int typeId);
+
+ /**
+ * Creates new portable builder.
+ *
+ * @param typeName Type name.
+ * @return Newly portable builder.
+ */
+ public PortableBuilder builder(String typeName);
+
+ /**
+ * Creates portable builder initialized by existing portable object.
+ *
+ * @param portableObj Portable object to initialize builder.
+ * @return Portable builder.
+ */
+ public PortableBuilder builder(PortableObject portableObj);
+
+ /**
+ * Gets metadata for provided class.
+ *
+ * @param cls Class.
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metadata(Class<?> cls) throws PortableException;
+
+ /**
+ * Gets metadata for provided class name.
+ *
+ * @param typeName Type name.
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metadata(String typeName) throws PortableException;
+
+ /**
+ * Gets metadata for provided type ID.
+ *
+ * @param typeId Type ID.
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metadata(int typeId) throws PortableException;
+
+ /**
+ * Gets metadata for all known types.
+ *
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ public Collection<PortableMetadata> metadata() throws PortableException;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
new file mode 100644
index 0000000..c819f46
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
@@ -0,0 +1,136 @@
+/*
+ * 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.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
+ * <p>
+ * Here is an example of how a portable object can be built dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
+ *
+ * builder.setField("fieldA", "A");
+ * builder.setField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ *
+ * <p>
+ * Also builder can be initialized by existing portable object. This allows changing some fields without affecting
+ * other fields.
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder(person);
+ *
+ * builder.setField("name", "John");
+ *
+ * person = builder.build();
+ * </pre>
+ * </p>
+ *
+ * If you need to modify nested portable object you can get builder for nested object using
+ * {@link #getField(String)}, changes made on nested builder will affect parent object,
+ * for example:
+ *
+ * <pre name=code class=java>
+ * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
+ * PortableBuilder addressBuilder = personBuilder.setField("address");
+ *
+ * addressBuilder.setField("city", "New York");
+ *
+ * personPortableObj = personBuilder.build();
+ *
+ * // Should be "New York".
+ * String city = personPortableObj.getField("address").getField("city");
+ * </pre>
+ *
+ * @see IgnitePortables#builder(int)
+ * @see IgnitePortables#builder(String)
+ * @see IgnitePortables#builder(PortableObject)
+ */
+public interface PortableBuilder {
+ /**
+ * Returns value assigned to the specified field.
+ * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
+ * which can be modified.
+ * <p>
+ * Collections and maps returned from this method are modifiable.
+ *
+ * @param name Field name.
+ * @return Filed value.
+ */
+ public <T> T getField(String name);
+
+ /**
+ * Sets field value.
+ *
+ * @param name Field name.
+ * @param val Field value (cannot be {@code null}).
+ * @see PortableObject#metaData()
+ */
+ public PortableBuilder setField(String name, Object val);
+
+ /**
+ * Sets field value with value type specification.
+ * <p>
+ * Field type is needed for proper metadata update.
+ *
+ * @param name Field name.
+ * @param val Field value.
+ * @param type Field type.
+ * @see PortableObject#metaData()
+ */
+ public <T> PortableBuilder setField(String name, @Nullable T val, Class<? super T> type);
+
+ /**
+ * Sets field value.
+ * <p>
+ * This method should be used if field is portable object.
+ *
+ * @param name Field name.
+ * @param builder Builder for object field.
+ */
+ public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
+
+ /**
+ * Removes field from this builder.
+ *
+ * @param fieldName Field name.
+ * @return {@code this} instance for chaining.
+ */
+ public PortableBuilder removeField(String fieldName);
+
+ /**
+ * Sets hash code for resulting portable object returned by {@link #build()} method.
+ * <p>
+ * If not set {@code 0} is used.
+ *
+ * @param hashCode Hash code.
+ * @return {@code this} instance for chaining.
+ */
+ public PortableBuilder hashCode(int hashCode);
+
+ /**
+ * Builds portable object.
+ *
+ * @return Portable object.
+ * @throws PortableException In case of error.
+ */
+ public PortableObject build() throws PortableException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
new file mode 100644
index 0000000..f230182
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api;
+
+import org.apache.ignite.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating portable object serialization error.
+ */
+public class PortableException extends IgniteException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates portable exception with error message.
+ *
+ * @param msg Error message.
+ */
+ public PortableException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates portable exception with {@link Throwable} as a cause.
+ *
+ * @param cause Cause.
+ */
+ public PortableException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates portable exception with error message and {@link Throwable} as a cause.
+ *
+ * @param msg Error message.
+ * @param cause Cause.
+ */
+ public PortableException(String msg, @Nullable Throwable cause) {
+ super(msg, cause);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
new file mode 100644
index 0000000..1e20f8e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
@@ -0,0 +1,54 @@
+/*
+ * 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.api;
+
+/**
+ * Type and field ID mapper for portable objects. Ignite never writes full
+ * strings for field or type names. Instead, for performance reasons, Ignite
+ * writes integer hash codes for type and field names. It has been tested that
+ * hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide {@code PortableIdMapper} allows to override the automatically
+ * generated hash code IDs for the type and field names.
+ * <p>
+ * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
+ * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
+ */
+public interface PortableIdMapper {
+ /**
+ * Gets type ID for provided class name.
+ * <p>
+ * If {@code 0} is returned, hash code of class simple name will be used.
+ *
+ * @param clsName Class name.
+ * @return Type ID.
+ */
+ public int typeId(String clsName);
+
+ /**
+ * Gets ID for provided field.
+ * <p>
+ * If {@code 0} is returned, hash code of field name will be used.
+ *
+ * @param typeId Type ID.
+ * @param fieldName Field name.
+ * @return Field ID.
+ */
+ public int fieldId(int typeId, String fieldName);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
new file mode 100644
index 0000000..82e6697
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
@@ -0,0 +1,58 @@
+/*
+ * 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.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating that class needed for deserialization of portable object does not exist.
+ * <p>
+ * Thrown from {@link PortableObject#deserialize()} method.
+ */
+public class PortableInvalidClassException extends PortableException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates invalid class exception with error message.
+ *
+ * @param msg Error message.
+ */
+ public PortableInvalidClassException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates invalid class exception with {@link Throwable} as a cause.
+ *
+ * @param cause Cause.
+ */
+ public PortableInvalidClassException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates invalid class exception with error message and {@link Throwable} as a cause.
+ *
+ * @param msg Error message.
+ * @param cause Cause.
+ */
+ public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
+ super(msg, cause);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
new file mode 100644
index 0000000..f304afb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
@@ -0,0 +1,48 @@
+/*
+ * 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.api;
+
+/**
+ * Interface that allows to implement custom serialization
+ * logic for portable objects. Portable objects are not required
+ * to implement this interface, in which case Ignite will automatically
+ * serialize portable objects using reflection.
+ * <p>
+ * This interface, in a way, is analogous to {@link java.io.Externalizable}
+ * interface, which allows users to override default serialization logic,
+ * usually for performance reasons. The only difference here is that portable
+ * serialization is already very fast and implementing custom serialization
+ * logic for portables does not provide significant performance gains.
+ */
+public interface PortableMarshalAware {
+ /**
+ * Writes fields to provided writer.
+ *
+ * @param writer Portable object writer.
+ * @throws PortableException In case of error.
+ */
+ public void writePortable(PortableWriter writer) throws PortableException;
+
+ /**
+ * Reads fields from provided reader.
+ *
+ * @param reader Portable object reader.
+ * @throws PortableException In case of error.
+ */
+ public void readPortable(PortableReader reader) throws PortableException;
+}
\ No newline at end of file
[08/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
deleted file mode 100644
index 7f23c1f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
+++ /dev/null
@@ -1,1021 +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.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectAllTypes;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectContainer;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectInner;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectOuter;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectPlainPortable;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
-import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import sun.misc.Unsafe;
-
-/**
- * Portable builder test.
- */
-public class GridPortableBuilderSelfTest extends GridCommonAbstractTest {
- /** */
- private static final Unsafe UNSAFE = GridUnsafe.unsafe();
-
- /** */
- protected static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName(),
- "org.gridgain.grid.internal.util.portable.mutabletest.*"));
-
- PortableTypeConfiguration customIdMapper = new PortableTypeConfiguration();
-
- customIdMapper.setClassName(CustomIdMapper.class.getName());
- customIdMapper.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return ~PortableContext.DFLT_ID_MAPPER.typeId(clsName);
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return typeId + ~PortableContext.DFLT_ID_MAPPER.fieldId(typeId, fieldName);
- }
- });
-
- marsh.setTypeConfigurations(Collections.singleton(customIdMapper));
-
- marsh.setConvertStringToBytes(useUtf8());
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrids(1);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @return Whether to use UTF8 strings.
- */
- protected boolean useUtf8() {
- return true;
- }
-
- /**
- *
- */
- public void testAllFieldsSerialization() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
- obj.setDefaultData();
- obj.enumArr = null;
-
- TestObjectAllTypes deserialized = builder(toPortable(obj)).build().deserialize();
-
- GridTestUtils.deepEquals(obj, deserialized);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testByteField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("byteField", (byte)1);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals((byte)1, po.<Byte>field("byteField").byteValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testShortField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("shortField", (short)1);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals((short)1, po.<Short>field("shortField").shortValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testIntField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("intField", 1);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(1, po.<Integer>field("intField").intValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLongField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("longField", 1L);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(1L, po.<Long>field("longField").longValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFloatField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("floatField", 1.0f);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(1.0f, po.<Float>field("floatField").floatValue(), 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDoubleField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("doubleField", 1.0d);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(1.0d, po.<Double>field("doubleField").doubleValue(), 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCharField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("charField", (char)1);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals((char)1, po.<Character>field("charField").charValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testBooleanField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("booleanField", true);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(po.<Boolean>field("booleanField"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDecimalField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("decimalField", BigDecimal.TEN);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(BigDecimal.TEN, po.<String>field("decimalField"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testStringField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("stringField", "str");
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals("str", po.<String>field("stringField"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUuidField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- UUID uuid = UUID.randomUUID();
-
- builder.setField("uuidField", uuid);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(uuid, po.<UUID>field("uuidField"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testByteArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("byteArrayField", new byte[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new byte[] {1, 2, 3}, po.<byte[]>field("byteArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testShortArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("shortArrayField", new short[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new short[] {1, 2, 3}, po.<short[]>field("shortArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testIntArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("intArrayField", new int[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new int[] {1, 2, 3}, po.<int[]>field("intArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLongArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("longArrayField", new long[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new long[] {1, 2, 3}, po.<long[]>field("longArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFloatArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("floatArrayField", new float[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new float[] {1, 2, 3}, po.<float[]>field("floatArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDoubleArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("doubleArrayField", new double[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new double[] {1, 2, 3}, po.<double[]>field("doubleArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCharArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("charArrayField", new char[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new char[] {1, 2, 3}, po.<char[]>field("charArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testBooleanArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("booleanArrayField", new boolean[] {true, false});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- boolean[] arr = po.field("booleanArrayField");
-
- assertEquals(2, arr.length);
-
- assertTrue(arr[0]);
- assertFalse(arr[1]);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDecimalArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("decimalArrayField", new BigDecimal[] {BigDecimal.ONE, BigDecimal.TEN});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new BigDecimal[] {BigDecimal.ONE, BigDecimal.TEN}, po.<String[]>field("decimalArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testStringArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("stringArrayField", new String[] {"str1", "str2", "str3"});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(new String[] {"str1", "str2", "str3"}, po.<String[]>field("stringArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUuidArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- UUID[] arr = new UUID[] {UUID.randomUUID(), UUID.randomUUID()};
-
- builder.setField("uuidArrayField", arr);
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertTrue(Arrays.equals(arr, po.<UUID[]>field("uuidArrayField")));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testObjectField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("objectField", new Value(1));
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(1, po.<PortableObject>field("objectField").<Value>deserialize().i);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testObjectArrayField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("objectArrayField", new Value[] {new Value(1), new Value(2)});
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- Object[] arr = po.field("objectArrayField");
-
- assertEquals(2, arr.length);
-
- assertEquals(1, ((PortableObject)arr[0]).<Value>deserialize().i);
- assertEquals(2, ((PortableObject)arr[1]).<Value>deserialize().i);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCollectionField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("collectionField", Arrays.asList(new Value(1), new Value(2)));
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- List<PortableObject> list = po.field("collectionField");
-
- assertEquals(2, list.size());
-
- assertEquals(1, list.get(0).<Value>deserialize().i);
- assertEquals(2, list.get(1).<Value>deserialize().i);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMapField() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("mapField", F.asMap(new Key(1), new Value(1), new Key(2), new Value(2)));
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- Map<PortableObject, PortableObject> map = po.field("mapField");
-
- assertEquals(2, map.size());
-
- for (Map.Entry<PortableObject, PortableObject> e : map.entrySet())
- assertEquals(e.getKey().<Key>deserialize().i, e.getValue().<Value>deserialize().i);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSeveralFields() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("i", 111);
- builder.setField("f", 111.111f);
- builder.setField("iArr", new int[] {1, 2, 3});
- builder.setField("obj", new Key(1));
- builder.setField("col", Arrays.asList(new Value(1), new Value(2)));
-
- PortableObject po = builder.build();
-
- assertEquals("class".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(111, po.<Integer>field("i").intValue());
- assertEquals(111.111f, po.<Float>field("f").floatValue(), 0);
- assertTrue(Arrays.equals(new int[] {1, 2, 3}, po.<int[]>field("iArr")));
- assertEquals(1, po.<PortableObject>field("obj").<Key>deserialize().i);
-
- List<PortableObject> list = po.field("col");
-
- assertEquals(2, list.size());
-
- assertEquals(1, list.get(0).<Value>deserialize().i);
- assertEquals(2, list.get(1).<Value>deserialize().i);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOffheapPortable() throws Exception {
- PortableBuilder builder = builder("Class");
-
- builder.hashCode(100);
-
- builder.setField("i", 111);
- builder.setField("f", 111.111f);
- builder.setField("iArr", new int[] {1, 2, 3});
- builder.setField("obj", new Key(1));
- builder.setField("col", Arrays.asList(new Value(1), new Value(2)));
-
- PortableObject po = builder.build();
-
- byte[] arr = ((CacheObjectPortableProcessorImpl)(grid(0)).context().cacheObjects()).marshal(po);
-
- long ptr = UNSAFE.allocateMemory(arr.length + 5);
-
- try {
- long ptr0 = ptr;
-
- UNSAFE.putBoolean(null, ptr0++, false);
-
- UNSAFE.putInt(ptr0, arr.length);
-
- UNSAFE.copyMemory(arr, BYTE_ARR_OFF, null, ptr0 + 4, arr.length);
-
- PortableObject offheapObj = (PortableObject)
- ((CacheObjectPortableProcessorImpl)(grid(0)).context().cacheObjects()).unmarshal(ptr, false);
-
- assertEquals(PortableObjectOffheapImpl.class, offheapObj.getClass());
-
- assertEquals("class".hashCode(), offheapObj.typeId());
- assertEquals(100, offheapObj.hashCode());
-
- assertEquals(111, offheapObj.<Integer>field("i").intValue());
- assertEquals(111.111f, offheapObj.<Float>field("f").floatValue(), 0);
- assertTrue(Arrays.equals(new int[] {1, 2, 3}, offheapObj.<int[]>field("iArr")));
- assertEquals(1, offheapObj.<PortableObject>field("obj").<Key>deserialize().i);
-
- List<PortableObject> list = offheapObj.field("col");
-
- assertEquals(2, list.size());
-
- assertEquals(1, list.get(0).<Value>deserialize().i);
- assertEquals(2, list.get(1).<Value>deserialize().i);
-
- assertEquals(po, offheapObj);
- assertEquals(offheapObj, po);
- }
- finally {
- UNSAFE.freeMemory(ptr);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testBuildAndDeserialize() throws Exception {
- PortableBuilder builder = builder(Value.class.getName());
-
- builder.hashCode(100);
-
- builder.setField("i", 1);
-
- PortableObject po = builder.build();
-
- assertEquals("value".hashCode(), po.typeId());
- assertEquals(100, po.hashCode());
-
- assertEquals(1, po.<Value>deserialize().i);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMetaData2() throws Exception {
- PortableBuilder builder = builder("org.test.MetaTest2");
-
- builder.setField("objectField", "a", Object.class);
-
- PortableObject po = builder.build();
-
- PortableMetadata meta = po.metaData();
-
- assertEquals("MetaTest2", meta.typeName());
- assertEquals("Object", meta.fieldTypeName("objectField"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMetaData() throws Exception {
- PortableBuilder builder = builder("org.test.MetaTest");
-
- builder.hashCode(100);
-
- builder.setField("intField", 1);
- builder.setField("byteArrayField", new byte[] {1, 2, 3});
-
- PortableObject po = builder.build();
-
- PortableMetadata meta = po.metaData();
-
- assertEquals("MetaTest", meta.typeName());
-
- Collection<String> fields = meta.fields();
-
- assertEquals(2, fields.size());
-
- assertTrue(fields.contains("intField"));
- assertTrue(fields.contains("byteArrayField"));
-
- assertEquals("int", meta.fieldTypeName("intField"));
- assertEquals("byte[]", meta.fieldTypeName("byteArrayField"));
-
- builder = builder("org.test.MetaTest");
-
- builder.hashCode(100);
-
- builder.setField("intField", 2);
- builder.setField("uuidField", UUID.randomUUID());
-
- po = builder.build();
-
- meta = po.metaData();
-
- assertEquals("MetaTest", meta.typeName());
-
- fields = meta.fields();
-
- assertEquals(3, fields.size());
-
- assertTrue(fields.contains("intField"));
- assertTrue(fields.contains("byteArrayField"));
- assertTrue(fields.contains("uuidField"));
-
- assertEquals("int", meta.fieldTypeName("intField"));
- assertEquals("byte[]", meta.fieldTypeName("byteArrayField"));
- assertEquals("UUID", meta.fieldTypeName("uuidField"));
- }
-
- /**
- *
- */
- public void testGetFromCopiedObj() {
- PortableObject objStr = builder(TestObjectAllTypes.class.getName()).setField("str", "aaa").build();
-
- PortableBuilderImpl builder = builder(objStr);
- assertEquals("aaa", builder.getField("str"));
-
- builder.setField("str", "bbb");
- assertEquals("bbb", builder.getField("str"));
-
- assertNull(builder.getField("i_"));
- assertEquals("bbb", builder.build().<TestObjectAllTypes>deserialize().str);
- }
-
- /**
- *
- */
- public void testCopyFromInnerObjects() {
- ArrayList<Object> list = new ArrayList<>();
- list.add(new TestObjectAllTypes());
- list.add(list.get(0));
-
- TestObjectContainer c = new TestObjectContainer(list);
-
- PortableBuilderImpl builder = builder(toPortable(c));
- builder.<List>getField("foo").add("!!!");
-
- PortableObject res = builder.build();
-
- TestObjectContainer deserialized = res.deserialize();
-
- List deserializedList = (List)deserialized.foo;
-
- assertSame(deserializedList.get(0), deserializedList.get(1));
- assertEquals("!!!", deserializedList.get(2));
- assertTrue(deserializedList.get(0) instanceof TestObjectAllTypes);
- }
-
- /**
- *
- */
- public void testSetPortableObject() {
- PortableObject portableObj = builder(TestObjectContainer.class.getName())
- .setField("foo", toPortable(new TestObjectAllTypes()))
- .build();
-
- assertTrue(portableObj.<TestObjectContainer>deserialize().foo instanceof TestObjectAllTypes);
- }
-
- /**
- *
- */
- public void testPlainPortableObjectCopyFrom() {
- TestObjectPlainPortable obj = new TestObjectPlainPortable(toPortable(new TestObjectAllTypes()));
-
- PortableBuilderImpl builder = builder(toPortable(obj));
- assertTrue(builder.getField("plainPortable") instanceof PortableObject);
-
- TestObjectPlainPortable deserialized = builder.build().deserialize();
- assertTrue(deserialized.plainPortable instanceof PortableObject);
- }
-
- /**
- *
- */
- public void testRemoveFromNewObject() {
- PortableBuilder builder = builder(TestObjectAllTypes.class.getName());
-
- builder.setField("str", "a");
-
- builder.removeField("str");
-
- assertNull(builder.build().<TestObjectAllTypes>deserialize().str);
- }
-
- /**
- *
- */
- public void testRemoveFromExistingObject() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
- obj.setDefaultData();
- obj.enumArr = null;
-
- PortableBuilder builder = builder(toPortable(obj));
-
- builder.removeField("str");
-
- assertNull(builder.build().<TestObjectAllTypes>deserialize().str);
- }
-
- /**
- *
- */
- public void testRemoveFromExistingObjectAfterGet() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
- obj.setDefaultData();
- obj.enumArr = null;
-
- PortableBuilderImpl builder = builder(toPortable(obj));
-
- builder.getField("i_");
-
- builder.removeField("str");
-
- assertNull(builder.build().<TestObjectAllTypes>deserialize().str);
- }
-
- /**
- * @throws IgniteCheckedException If any error occurs.
- */
- public void testDontBrokeCyclicDependency() throws IgniteCheckedException {
- TestObjectOuter outer = new TestObjectOuter();
- outer.inner = new TestObjectInner();
- outer.inner.outer = outer;
- outer.foo = "a";
-
- PortableBuilder builder = builder(toPortable(outer));
-
- builder.setField("foo", "b");
-
- TestObjectOuter res = builder.build().deserialize();
-
- assertEquals("b", res.foo);
- assertSame(res, res.inner.outer);
- }
-
- /**
- * @return Portables.
- */
- private IgnitePortables portables() {
- return grid(0).portables();
- }
-
- /**
- * @param obj Object.
- * @return Portable object.
- */
- private PortableObject toPortable(Object obj) {
- return portables().toPortable(obj);
- }
-
- /**
- * @return Builder.
- */
- private <T> PortableBuilder builder(int typeId) {
- return portables().builder(typeId);
- }
-
- /**
- * @return Builder.
- */
- private <T> PortableBuilder builder(String clsName) {
- return portables().builder(clsName);
- }
-
- /**
- * @return Builder.
- */
- private <T> PortableBuilderImpl builder(PortableObject obj) {
- return (PortableBuilderImpl)portables().builder(obj);
- }
-
- /**
- *
- */
- private static class CustomIdMapper {
- /** */
- private String str = "a";
-
- /** */
- private int i = 10;
- }
-
- /**
- */
- private static class Key {
- /** */
- private int i;
-
- /**
- */
- private Key() {
- // No-op.
- }
-
- /**
- * @param i Index.
- */
- private Key(int i) {
- this.i = i;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- Key key = (Key)o;
-
- return i == key.i;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return i;
- }
- }
-
- /**
- */
- private static class Value {
- /** */
- private int i;
-
- /**
- */
- private Value() {
- // No-op.
- }
-
- /**
- * @param i Index.
- */
- private Value(int i) {
- this.i = i;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java
deleted file mode 100644
index 2fce1a5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- *
- */
-public class GridPortableBuilderStringAsCharsAdditionalSelfTest extends GridPortableBuilderAdditionalSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean useUtf8() {
- return false;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java
deleted file mode 100644
index 5c53233..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * Portable builder test.
- */
-public class GridPortableBuilderStringAsCharsSelfTest extends GridPortableBuilderSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean useUtf8() {
- return false;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
deleted file mode 100644
index bd9612c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
+++ /dev/null
@@ -1,256 +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.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Arrays;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.MarshallerContextAdapter;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class GridPortableMarshallerCtxDisabledSelfTest extends GridCommonAbstractTest {
- /** */
- 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 testObjectExchange() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
- marsh.setContext(new MarshallerContextWithNoStorage());
-
- PortableContext context = new PortableContext(META_HND, null);
-
- IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", context);
-
- SimpleObject simpleObj = new SimpleObject();
-
- simpleObj.b = 2;
- simpleObj.bArr = new byte[] {2, 3, 4, 5, 5};
- simpleObj.c = 'A';
- simpleObj.enumVal = TestEnum.D;
- simpleObj.objArr = new Object[] {"hello", "world", "from", "me"};
- simpleObj.enumArr = new TestEnum[] {TestEnum.C, TestEnum.B};
-
- SimpleObject otherObj = new SimpleObject();
-
- otherObj.b = 3;
- otherObj.bArr = new byte[] {5, 3, 4};
-
- simpleObj.otherObj = otherObj;
-
- assertEquals(simpleObj, marsh.unmarshal(marsh.marshal(simpleObj), null));
-
- SimplePortable simplePortable = new SimplePortable();
-
- simplePortable.str = "portable";
- simplePortable.arr = new long[] {100, 200, 300};
-
- assertEquals(simplePortable, marsh.unmarshal(marsh.marshal(simplePortable), null));
-
- SimpleExternalizable simpleExtr = new SimpleExternalizable();
-
- simpleExtr.str = "externalizable";
- simpleExtr.arr = new long[] {20000, 300000, 400000};
-
- assertEquals(simpleExtr, marsh.unmarshal(marsh.marshal(simpleExtr), null));
- }
-
- /**
- * Marshaller context with no storage. Platform has to work in such environment as well by marshalling class name of
- * a portable object.
- */
- private static class MarshallerContextWithNoStorage extends MarshallerContextAdapter {
- /** */
- public MarshallerContextWithNoStorage() {
- super(null);
- }
-
- /** {@inheritDoc} */
- @Override protected boolean registerClassName(int id, String clsName) throws IgniteCheckedException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected String className(int id) throws IgniteCheckedException {
- return null;
- }
- }
-
- /**
- */
- private enum TestEnum {
- A, B, C, D, E
- }
-
- /**
- */
- private static class SimpleObject {
- /** */
- private byte b;
-
- /** */
- private char c;
-
- /** */
- private byte[] bArr;
-
- /** */
- private Object[] objArr;
-
- /** */
- private TestEnum enumVal;
-
- /** */
- private TestEnum[] enumArr;
-
- private SimpleObject otherObj;
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- SimpleObject object = (SimpleObject)o;
-
- if (b != object.b)
- return false;
-
- if (c != object.c)
- return false;
-
- if (!Arrays.equals(bArr, object.bArr))
- return false;
-
- // Probably incorrect - comparing Object[] arrays with Arrays.equals
- if (!Arrays.equals(objArr, object.objArr))
- return false;
-
- if (enumVal != object.enumVal)
- return false;
-
- // Probably incorrect - comparing Object[] arrays with Arrays.equals
- if (!Arrays.equals(enumArr, object.enumArr))
- return false;
-
- return !(otherObj != null ? !otherObj.equals(object.otherObj) : object.otherObj != null);
- }
- }
-
- /**
- *
- */
- private static class SimplePortable implements PortableMarshalAware {
- /** */
- private String str;
-
- /** */
- private long[] arr;
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeString("str", str);
- writer.writeLongArray("longArr", arr);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- str = reader.readString("str");
- arr = reader.readLongArray("longArr");
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- SimplePortable that = (SimplePortable)o;
-
- if (str != null ? !str.equals(that.str) : that.str != null)
- return false;
-
- return Arrays.equals(arr, that.arr);
- }
- }
-
- /**
- *
- */
- private static class SimpleExternalizable implements Externalizable {
- /** */
- private String str;
-
- /** */
- private long[] arr;
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(str);
- out.writeObject(arr);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- str = in.readUTF();
- arr = (long[])in.readObject();
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- SimpleExternalizable that = (SimpleExternalizable)o;
-
- if (str != null ? !str.equals(that.str) : that.str != null)
- return false;
-
- return Arrays.equals(arr, that.arr);
- }
- }
-}
\ No newline at end of file
[09/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
deleted file mode 100644
index 0d7160f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
+++ /dev/null
@@ -1,266 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Writer for portable object used in {@link PortableMarshalAware} implementations.
- * Useful for the cases when user wants a fine-grained control over serialization.
- * <p>
- * Note that Ignite never writes full strings for field or type names. Instead,
- * for performance reasons, Ignite writes integer hash codes for type and field names.
- * It has been tested that hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide, Ignite provides {@link PortableIdMapper} which
- * allows to override the automatically generated hash code IDs for the type and field names.
- */
-public interface PortableWriter {
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByte(String fieldName, byte val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShort(String fieldName, short val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeInt(String fieldName, int val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLong(String fieldName, long val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloat(String fieldName, float val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDouble(String fieldName, double val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeChar(String fieldName, char val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBoolean(String fieldName, boolean val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeString(String fieldName, @Nullable String val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val UUID to write.
- * @throws PortableException In case of error.
- */
- public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Date to write.
- * @throws PortableException In case of error.
- */
- public void writeDate(String fieldName, @Nullable Date val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Timestamp to write.
- * @throws PortableException In case of error.
- */
- public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param obj Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObject(String fieldName, @Nullable Object obj) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param col Collection to write.
- * @throws PortableException In case of error.
- */
- public <T> void writeCollection(String fieldName, @Nullable Collection<T> col) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param map Map to write.
- * @throws PortableException In case of error.
- */
- public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws PortableException;
-
- /**
- * Gets raw writer. Raw writer does not write field name hash codes, therefore,
- * making the format even more compact. However, if the raw writer is used,
- * dynamic structure changes to the portable objects are not supported.
- *
- * @return Raw writer.
- */
- public PortableRawWriter rawWriter();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/package-info.java b/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
deleted file mode 100644
index 0105b15..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains portable objects API classes.
- */
-package org.apache.ignite.portable;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 70c32e5..36ac156 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1572,10 +1572,10 @@ org.apache.ignite.plugin.security.SecuritySubject
org.apache.ignite.plugin.security.SecuritySubjectType
org.apache.ignite.plugin.segmentation.SegmentationPolicy
org.apache.ignite.plugin.segmentation.SegmentationResolver
-org.apache.ignite.portable.PortableException
-org.apache.ignite.portable.PortableInvalidClassException
-org.apache.ignite.portable.PortableObject
-org.apache.ignite.portable.PortableProtocolVersion
+org.apache.ignite.internal.portable.api.PortableException
+org.apache.ignite.internal.portable.api.PortableInvalidClassException
+org.apache.ignite.internal.portable.api.PortableObject
+org.apache.ignite.internal.portable.api.PortableProtocolVersion
org.apache.ignite.services.Service
org.apache.ignite.services.ServiceConfiguration
org.apache.ignite.services.ServiceContext
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index 82da10f..dc73cff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -159,51 +159,6 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
}
/**
- * @throws Exception If failed.
- */
- public void testDifferentPortableProtocolVersions() throws Exception {
- startGridWithPortableProtocolVer("VER_99_99_99");
-
- try {
- startGrid(1);
-
- fail();
- }
- catch (IgniteCheckedException e) {
- if (!e.getCause().getMessage().startsWith("Remote node has portable protocol version different from local"))
- throw e;
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testNullPortableProtocolVersion() throws Exception {
- startGridWithPortableProtocolVer(null);
-
- // Must not fail in order to preserve backward compatibility with the nodes that don't have this property yet.
- startGrid(1);
- }
-
- /**
- * @throws Exception If failed.
- */
- private void startGridWithPortableProtocolVer(String ver) throws Exception {
- Ignite ignite = startGrid(0);
-
- ClusterNode clusterNode = ignite.cluster().localNode();
-
- Field f = clusterNode.getClass().getDeclaredField("attrs");
- f.setAccessible(true);
-
- Map<String, Object> attrs = new HashMap<>((Map<String, Object>)f.get(clusterNode));
-
- attrs.put(IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER, ver);
-
- f.set(clusterNode, attrs);
- }
-
- /**
* @param preferIpV4 {@code java.net.preferIPv4Stack} system property value.
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
deleted file mode 100644
index 59084db..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
+++ /dev/null
@@ -1,218 +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.Collections;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.CacheObjectContext;
-import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.lang.IgniteRunnable;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable object affinity key.
- */
-public class GridPortableAffinityKeySelfTest extends GridCommonAbstractTest {
- /** */
- private static final AtomicReference<UUID> nodeId = new AtomicReference<>();
-
- /** VM ip finder for TCP discovery. */
- private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static int GRID_CNT = 5;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
- typeCfg.setClassName(TestObject.class.getName());
- typeCfg.setAffinityKeyFieldName("affKey");
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Collections.singleton(typeCfg));
-
- cfg.setMarshaller(marsh);
-
- if (!gridName.equals(getTestGridName(GRID_CNT))) {
- CacheConfiguration cacheCfg = new CacheConfiguration();
-
- cacheCfg.setCacheMode(PARTITIONED);
-
- cfg.setCacheConfiguration(cacheCfg);
- }
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(GRID_CNT);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testAffinity() throws Exception {
- checkAffinity(grid(0));
-
- try (Ignite igniteNoCache = startGrid(GRID_CNT)) {
- try {
- igniteNoCache.cache(null);
- }
- catch (IllegalArgumentException ignore) {
- // Expected error.
- }
-
- checkAffinity(igniteNoCache);
- }
- }
-
- /**
- * @param ignite Ignite.
- * @throws Exception If failed.
- */
- private void checkAffinity(Ignite ignite) throws Exception {
- Affinity<Object> aff = ignite.affinity(null);
-
- GridAffinityProcessor affProc = ((IgniteKernal)ignite).context().affinity();
-
- IgniteCacheObjectProcessor cacheObjProc = ((IgniteKernal)ignite).context().cacheObjects();
-
- CacheObjectContext cacheObjCtx = cacheObjProc.contextForCache(
- ignite.cache(null).getConfiguration(CacheConfiguration.class));
-
- for (int i = 0; i < 1000; i++) {
- assertEquals(i, aff.affinityKey(i));
-
- assertEquals(i, aff.affinityKey(new TestObject(i)));
-
- CacheObject cacheObj = cacheObjProc.toCacheObject(cacheObjCtx, new TestObject(i), true);
-
- assertEquals(i, aff.affinityKey(cacheObj));
-
- assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(new TestObject(i)));
-
- assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(cacheObj));
-
- assertEquals(i, affProc.affinityKey(null, i));
-
- assertEquals(i, affProc.affinityKey(null, new TestObject(i)));
-
- assertEquals(i, affProc.affinityKey(null, cacheObj));
-
- assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, new TestObject(i)));
-
- assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, cacheObj));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testAffinityRun() throws Exception {
- Affinity<Object> aff = grid(0).affinity(null);
-
- for (int i = 0; i < 1000; i++) {
- nodeId.set(null);
-
- grid(0).compute().affinityRun(null, new TestObject(i), new IgniteRunnable() {
- @IgniteInstanceResource
- private Ignite ignite;
-
- @Override public void run() {
- nodeId.set(ignite.configuration().getNodeId());
- }
- });
-
- assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testAffinityCall() throws Exception {
- Affinity<Object> aff = grid(0).affinity(null);
-
- for (int i = 0; i < 1000; i++) {
- nodeId.set(null);
-
- grid(0).compute().affinityCall(null, new TestObject(i), new IgniteCallable<Object>() {
- @IgniteInstanceResource
- private Ignite ignite;
-
- @Override public Object call() {
- nodeId.set(ignite.configuration().getNodeId());
-
- return null;
- }
- });
-
- assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
- }
- }
-
- /**
- */
- private static class TestObject {
- /** */
- @SuppressWarnings("UnusedDeclaration")
- private int affKey;
-
- /**
- */
- private TestObject() {
- // No-op.
- }
-
- /**
- * @param affKey Affinity key.
- */
- private TestObject(int affKey) {
- this.affKey = affKey;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
deleted file mode 100644
index 61ec714..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
+++ /dev/null
@@ -1,1226 +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 com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.portable.builder.PortableBuilderEnum;
-import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableMarshalerAwareTestClass;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
-import org.apache.ignite.internal.processors.cache.portable.IgnitePortablesImpl;
-import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assert;
-
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.Address;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.AddressBook;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.Company;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectAllTypes;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectArrayList;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectContainer;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectEnum;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectInner;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectOuter;
-
-/**
- *
- */
-public class GridPortableBuilderAdditionalSelfTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- CacheConfiguration cacheCfg = new CacheConfiguration();
-
- cacheCfg.setCacheMode(REPLICATED);
-
- cfg.setCacheConfiguration(cacheCfg);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList("org.apache.ignite.internal.portable.mutabletest.*"));
-
- marsh.setConvertStringToBytes(useUtf8());
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrids(1);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- jcache(0).clear();
- }
-
- /**
- * @return Whether to use UTF8 strings.
- */
- protected boolean useUtf8() {
- return true;
- }
-
- /**
- * @return Portables API.
- */
- protected IgnitePortables portables() {
- return grid(0).portables();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSimpleTypeFieldRead() throws Exception {
- TestObjectAllTypes exp = new TestObjectAllTypes();
-
- exp.setDefaultData();
-
- PortableBuilder mutPo = wrap(exp);
-
- for (Field field : TestObjectAllTypes.class.getDeclaredFields()) {
- Object expVal = field.get(exp);
- Object actVal = mutPo.getField(field.getName());
-
- switch (field.getName()) {
- case "anEnum":
- assertEquals(((PortableBuilderEnum)actVal).getOrdinal(), ((Enum)expVal).ordinal());
- break;
-
- case "enumArr": {
- PortableBuilderEnum[] actArr = (PortableBuilderEnum[])actVal;
- Enum[] expArr = (Enum[])expVal;
-
- assertEquals(expArr.length, actArr.length);
-
- for (int i = 0; i < actArr.length; i++)
- assertEquals(expArr[i].ordinal(), actArr[i].getOrdinal());
-
- break;
- }
-
- case "entry":
- assertEquals(((Map.Entry)expVal).getKey(), ((Map.Entry)actVal).getKey());
- assertEquals(((Map.Entry)expVal).getValue(), ((Map.Entry)actVal).getValue());
- break;
-
- default:
- assertTrue(field.getName(), Objects.deepEquals(expVal, actVal));
- break;
- }
- }
- }
-
- /**
- *
- */
- public void testSimpleTypeFieldSerialize() {
- TestObjectAllTypes exp = new TestObjectAllTypes();
-
- exp.setDefaultData();
-
- PortableBuilderImpl mutPo = wrap(exp);
-
- TestObjectAllTypes res = mutPo.build().deserialize();
-
- GridTestUtils.deepEquals(exp, res);
- }
-
- /**
- * @throws Exception If any error occurs.
- */
- public void testSimpleTypeFieldOverride() throws Exception {
- TestObjectAllTypes exp = new TestObjectAllTypes();
-
- exp.setDefaultData();
-
- PortableBuilderImpl mutPo = wrap(new TestObjectAllTypes());
-
- for (Field field : TestObjectAllTypes.class.getDeclaredFields())
- mutPo.setField(field.getName(), field.get(exp));
-
- TestObjectAllTypes res = mutPo.build().deserialize();
-
- GridTestUtils.deepEquals(exp, res);
- }
-
- /**
- * @throws Exception If any error occurs.
- */
- public void testSimpleTypeFieldSetNull() throws Exception {
- TestObjectAllTypes exp = new TestObjectAllTypes();
-
- exp.setDefaultData();
-
- PortableBuilderImpl mutPo = wrap(exp);
-
- for (Field field : TestObjectAllTypes.class.getDeclaredFields()) {
- if (!field.getType().isPrimitive())
- mutPo.setField(field.getName(), null);
- }
-
- TestObjectAllTypes res = mutPo.build().deserialize();
-
- for (Field field : TestObjectAllTypes.class.getDeclaredFields()) {
- if (!field.getType().isPrimitive())
- assertNull(field.getName(), field.get(res));
- }
- }
-
- /**
- * @throws IgniteCheckedException If any error occurs.
- */
- public void testMakeCyclicDependency() throws IgniteCheckedException {
- TestObjectOuter outer = new TestObjectOuter();
- outer.inner = new TestObjectInner();
-
- PortableBuilderImpl mutOuter = wrap(outer);
-
- PortableBuilderImpl mutInner = mutOuter.getField("inner");
-
- mutInner.setField("outer", mutOuter);
- mutInner.setField("foo", mutInner);
-
- TestObjectOuter res = mutOuter.build().deserialize();
-
- assertEquals(res, res.inner.outer);
- assertEquals(res.inner, res.inner.foo);
- }
-
- /**
- *
- */
- public void testDateArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.dateArr = new Date[] {new Date(11111), new Date(11111), new Date(11111)};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Date[] arr = mutObj.getField("dateArr");
- arr[0] = new Date(22222);
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new Date[] {new Date(22222), new Date(11111), new Date(11111)}, res.dateArr);
- }
-
- /**
- *
- */
- public void testUUIDArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.uuidArr = new UUID[] {new UUID(1, 1), new UUID(1, 1), new UUID(1, 1)};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- UUID[] arr = mutObj.getField("uuidArr");
- arr[0] = new UUID(2, 2);
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new UUID[] {new UUID(2, 2), new UUID(1, 1), new UUID(1, 1)}, res.uuidArr);
- }
-
- /**
- *
- */
- public void testDecimalArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.bdArr = new BigDecimal[] {new BigDecimal(1000), new BigDecimal(1000), new BigDecimal(1000)};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- BigDecimal[] arr = mutObj.getField("bdArr");
- arr[0] = new BigDecimal(2000);
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new BigDecimal[] {new BigDecimal(1000), new BigDecimal(1000), new BigDecimal(1000)},
- res.bdArr);
- }
-
- /**
- *
- */
- public void testBooleanArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.zArr = new boolean[] {false, false, false};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- boolean[] arr = mutObj.getField("zArr");
- arr[0] = true;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- boolean[] expected = new boolean[] {true, false, false};
-
- assertEquals(expected.length, res.zArr.length);
-
- for (int i = 0; i < expected.length; i++)
- assertEquals(expected[i], res.zArr[i]);
- }
-
- /**
- *
- */
- public void testCharArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.cArr = new char[] {'a', 'a', 'a'};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- char[] arr = mutObj.getField("cArr");
- arr[0] = 'b';
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new char[] {'b', 'a', 'a'}, res.cArr);
- }
-
- /**
- *
- */
- public void testDoubleArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.dArr = new double[] {1.0, 1.0, 1.0};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- double[] arr = mutObj.getField("dArr");
- arr[0] = 2.0;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new double[] {2.0, 1.0, 1.0}, res.dArr, 0);
- }
-
- /**
- *
- */
- public void testFloatArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.fArr = new float[] {1.0f, 1.0f, 1.0f};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- float[] arr = mutObj.getField("fArr");
- arr[0] = 2.0f;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new float[] {2.0f, 1.0f, 1.0f}, res.fArr, 0);
- }
-
- /**
- *
- */
- public void testLongArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.lArr = new long[] {1, 1, 1};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- long[] arr = mutObj.getField("lArr");
- arr[0] = 2;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new long[] {2, 1, 1}, res.lArr);
- }
-
- /**
- *
- */
- public void testIntArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.iArr = new int[] {1, 1, 1};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- int[] arr = mutObj.getField("iArr");
- arr[0] = 2;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new int[] {2, 1, 1}, res.iArr);
- }
-
- /**
- *
- */
- public void testShortArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.sArr = new short[] {1, 1, 1};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- short[] arr = mutObj.getField("sArr");
- arr[0] = 2;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new short[] {2, 1, 1}, res.sArr);
- }
-
- /**
- *
- */
- public void testByteArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.bArr = new byte[] {1, 1, 1};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- byte[] arr = mutObj.getField("bArr");
- arr[0] = 2;
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new byte[] {2, 1, 1}, res.bArr);
- }
-
- /**
- *
- */
- public void testStringArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.strArr = new String[] {"a", "a", "a"};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- String[] arr = mutObj.getField("strArr");
- arr[0] = "b";
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new String[] {"b", "a", "a"}, res.strArr);
- }
-
- /**
- *
- */
- public void testModifyObjectArray() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = new Object[] {"a"};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Object[] arr = mutObj.getField("foo");
-
- Assert.assertArrayEquals(new Object[] {"a"}, arr);
-
- arr[0] = "b";
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new Object[] {"b"}, (Object[])res.foo);
- }
-
- /**
- *
- */
- public void testOverrideObjectArrayField() {
- PortableBuilderImpl mutObj = wrap(new TestObjectContainer());
-
- Object[] createdArr = {mutObj, "a", 1, new String[] {"s", "s"}, new byte[] {1, 2}, new UUID(3, 0)};
-
- mutObj.setField("foo", createdArr.clone());
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- createdArr[0] = res;
-
- assertTrue(Objects.deepEquals(createdArr, res.foo));
- }
-
- /**
- *
- */
- public void testDeepArray() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = new Object[] {new Object[] {"a", obj}};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Object[] arr = (Object[])mutObj.<Object[]>getField("foo")[0];
-
- assertEquals("a", arr[0]);
- assertSame(mutObj, arr[1]);
-
- arr[0] = mutObj;
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- arr = (Object[])((Object[])res.foo)[0];
-
- assertSame(arr[0], res);
- assertSame(arr[0], arr[1]);
- }
-
- /**
- *
- */
- public void testArrayListRead() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Lists.newArrayList(obj, "a");
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- List<Object> list = mutObj.getField("foo");
-
- assert list.equals(Lists.newArrayList(mutObj, "a"));
- }
-
- /**
- *
- */
- public void testArrayListOverride() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- ArrayList<Object> list = Lists.newArrayList(mutObj, "a", Lists.newArrayList(1, 2));
-
- mutObj.setField("foo", list);
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- list.set(0, res);
-
- assertNotSame(list, res.foo);
- assertEquals(list, res.foo);
- }
-
- /**
- *
- */
- public void testArrayListModification() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Lists.newArrayList("a", "b", "c");
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- List<String> list = mutObj.getField("foo");
-
- list.add("!"); // "a", "b", "c", "!"
- list.add(0, "_"); // "_", "a", "b", "c", "!"
-
- String s = list.remove(1); // "_", "b", "c", "!"
- assertEquals("a", s);
-
- assertEquals(Arrays.asList("c", "!"), list.subList(2, 4));
- assertEquals(1, list.indexOf("b"));
- assertEquals(1, list.lastIndexOf("b"));
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- assertTrue(res.foo instanceof ArrayList);
- assertEquals(Arrays.asList("_", "b", "c", "!"), res.foo);
- }
-
- /**
- *
- */
- public void testArrayListClear() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Lists.newArrayList("a", "b", "c");
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- List<String> list = mutObj.getField("foo");
-
- list.clear();
-
- assertEquals(Collections.emptyList(), mutObj.build().<TestObjectContainer>deserialize().foo);
- }
-
- /**
- *
- */
- public void testArrayListWriteUnmodifiable() {
- TestObjectContainer obj = new TestObjectContainer();
-
- ArrayList<Object> src = Lists.newArrayList(obj, "a", "b", "c");
-
- obj.foo = src;
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- TestObjectContainer deserialized = mutObj.build().deserialize();
-
- List<Object> res = (List<Object>)deserialized.foo;
-
- src.set(0, deserialized);
-
- assertEquals(src, res);
- }
-
- /**
- *
- */
- public void testLinkedListRead() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Lists.newLinkedList(Arrays.asList(obj, "a"));
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- List<Object> list = mutObj.getField("foo");
-
- assert list.equals(Lists.newLinkedList(Arrays.asList(mutObj, "a")));
- }
-
- /**
- *
- */
- public void testLinkedListOverride() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- List<Object> list = Lists.newLinkedList(Arrays.asList(mutObj, "a", Lists.newLinkedList(Arrays.asList(1, 2))));
-
- mutObj.setField("foo", list);
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- list.set(0, res);
-
- assertNotSame(list, res.foo);
- assertEquals(list, res.foo);
- }
-
- /**
- *
- */
- public void testLinkedListModification() {
- TestObjectContainer obj = new TestObjectContainer();
-
- obj.foo = Lists.newLinkedList(Arrays.asList("a", "b", "c"));
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- List<String> list = mutObj.getField("foo");
-
- list.add("!"); // "a", "b", "c", "!"
- list.add(0, "_"); // "_", "a", "b", "c", "!"
-
- String s = list.remove(1); // "_", "b", "c", "!"
- assertEquals("a", s);
-
- assertEquals(Arrays.asList("c", "!"), list.subList(2, 4));
- assertEquals(1, list.indexOf("b"));
- assertEquals(1, list.lastIndexOf("b"));
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- assertTrue(res.foo instanceof LinkedList);
- assertEquals(Arrays.asList("_", "b", "c", "!"), res.foo);
- }
-
- /**
- *
- */
- public void testLinkedListWriteUnmodifiable() {
- TestObjectContainer obj = new TestObjectContainer();
-
- LinkedList<Object> src = Lists.newLinkedList(Arrays.asList(obj, "a", "b", "c"));
-
- obj.foo = src;
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- TestObjectContainer deserialized = mutObj.build().deserialize();
-
- List<Object> res = (List<Object>)deserialized.foo;
-
- src.set(0, deserialized);
-
- assertEquals(src, res);
- }
-
- /**
- *
- */
- public void testHashSetRead() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Sets.newHashSet(obj, "a");
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Set<Object> set = mutObj.getField("foo");
-
- assert set.equals(Sets.newHashSet(mutObj, "a"));
- }
-
- /**
- *
- */
- public void testHashSetOverride() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Set<Object> c = Sets.newHashSet(mutObj, "a", Sets.newHashSet(1, 2));
-
- mutObj.setField("foo", c);
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- c.remove(mutObj);
- c.add(res);
-
- assertNotSame(c, res.foo);
- assertEquals(c, res.foo);
- }
-
- /**
- *
- */
- public void testHashSetModification() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Sets.newHashSet("a", "b", "c");
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Set<String> set = mutObj.getField("foo");
-
- set.remove("b");
- set.add("!");
-
- assertEquals(Sets.newHashSet("a", "!", "c"), set);
- assertTrue(set.contains("a"));
- assertTrue(set.contains("!"));
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- assertTrue(res.foo instanceof HashSet);
- assertEquals(Sets.newHashSet("a", "!", "c"), res.foo);
- }
-
- /**
- *
- */
- public void testHashSetWriteUnmodifiable() {
- TestObjectContainer obj = new TestObjectContainer();
-
- Set<Object> src = Sets.newHashSet(obj, "a", "b", "c");
-
- obj.foo = src;
-
- TestObjectContainer deserialized = wrap(obj).build().deserialize();
-
- Set<Object> res = (Set<Object>)deserialized.foo;
-
- src.remove(obj);
- src.add(deserialized);
-
- assertEquals(src, res);
- }
-
- /**
- *
- */
- public void testMapRead() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Maps.newHashMap(ImmutableMap.of(obj, "a", "b", obj));
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Map<Object, Object> map = mutObj.getField("foo");
-
- assert map.equals(ImmutableMap.of(mutObj, "a", "b", mutObj));
- }
-
- /**
- *
- */
- public void testMapOverride() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Map<Object, Object> map = Maps.newHashMap(ImmutableMap.of(mutObj, "a", "b", mutObj));
-
- mutObj.setField("foo", map);
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- assertEquals(ImmutableMap.of(res, "a", "b", res), res.foo);
- }
-
- /**
- *
- */
- public void testMapModification() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Maps.newHashMap(ImmutableMap.of(1, "a", 2, "b"));
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- Map<Object, Object> map = mutObj.getField("foo");
-
- map.put(3, mutObj);
- Object rmv = map.remove(1);
-
- assertEquals("a", rmv);
-
- TestObjectContainer res = mutObj.build().deserialize();
-
- assertEquals(ImmutableMap.of(2, "b", 3, res), res.foo);
- }
-
- /**
- *
- */
- public void testEnumArrayModification() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
-
- obj.enumArr = new TestObjectEnum[] {TestObjectEnum.A, TestObjectEnum.B};
-
- PortableBuilderImpl mutObj = wrap(obj);
-
- PortableBuilderEnum[] arr = mutObj.getField("enumArr");
- arr[0] = new PortableBuilderEnum(mutObj.typeId(), TestObjectEnum.B);
-
- TestObjectAllTypes res = mutObj.build().deserialize();
-
- Assert.assertArrayEquals(new TestObjectEnum[] {TestObjectEnum.A, TestObjectEnum.B}, res.enumArr);
- }
-
- /**
- *
- */
- public void testEditObjectWithRawData() {
- GridPortableMarshalerAwareTestClass obj = new GridPortableMarshalerAwareTestClass();
-
- obj.s = "a";
- obj.sRaw = "aa";
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- mutableObj.setField("s", "z");
-
- GridPortableMarshalerAwareTestClass res = mutableObj.build().deserialize();
- assertEquals("z", res.s);
- assertEquals("aa", res.sRaw);
- }
-
- /**
- *
- */
- public void testHashCode() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- assertEquals(obj.hashCode(), mutableObj.build().hashCode());
-
- mutableObj.hashCode(25);
-
- assertEquals(25, mutableObj.build().hashCode());
- }
-
- /**
- *
- */
- public void testCollectionsInCollection() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = Lists.newArrayList(
- Lists.newArrayList(1, 2),
- Lists.newLinkedList(Arrays.asList(1, 2)),
- Sets.newHashSet("a", "b"),
- Sets.newLinkedHashSet(Arrays.asList("a", "b")),
- Maps.newHashMap(ImmutableMap.of(1, "a", 2, "b")));
-
- TestObjectContainer deserialized = wrap(obj).build().deserialize();
-
- assertEquals(obj.foo, deserialized.foo);
- }
-
- /**
- *
- */
- public void testMapEntryModification() {
- TestObjectContainer obj = new TestObjectContainer();
- obj.foo = ImmutableMap.of(1, "a").entrySet().iterator().next();
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- Map.Entry<Object, Object> entry = mutableObj.getField("foo");
-
- assertEquals(1, entry.getKey());
- assertEquals("a", entry.getValue());
-
- entry.setValue("b");
-
- TestObjectContainer res = mutableObj.build().deserialize();
-
- assertEquals(new GridMapEntry<>(1, "b"), res.foo);
- }
-
- /**
- *
- */
- public void testMapEntryOverride() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- mutableObj.setField("foo", new GridMapEntry<>(1, "a"));
-
- TestObjectContainer res = mutableObj.build().deserialize();
-
- assertEquals(new GridMapEntry<>(1, "a"), res.foo);
- }
-
- /**
- *
- */
- public void testMetadataChangingDoublePut() {
- PortableBuilderImpl mutableObj = wrap(new TestObjectContainer());
-
- mutableObj.setField("xx567", "a");
- mutableObj.setField("xx567", "b");
-
- mutableObj.build();
-
- PortableMetadata metadata = portables().metadata(TestObjectContainer.class);
-
- assertEquals("String", metadata.fieldTypeName("xx567"));
- }
-
- /**
- *
- */
- public void testMetadataChangingDoublePut2() {
- PortableBuilderImpl mutableObj = wrap(new TestObjectContainer());
-
- mutableObj.setField("xx567", "a");
- mutableObj.setField("xx567", "b");
-
- mutableObj.build();
-
- PortableMetadata metadata = portables().metadata(TestObjectContainer.class);
-
- assertEquals("String", metadata.fieldTypeName("xx567"));
- }
-
- /**
- *
- */
- public void testMetadataChanging() {
- TestObjectContainer c = new TestObjectContainer();
-
- PortableBuilderImpl mutableObj = wrap(c);
-
- mutableObj.setField("intField", 1);
- mutableObj.setField("intArrField", new int[] {1});
- mutableObj.setField("arrField", new String[] {"1"});
- mutableObj.setField("strField", "1");
- mutableObj.setField("colField", Lists.newArrayList("1"));
- mutableObj.setField("mapField", Maps.newHashMap(ImmutableMap.of(1, "1")));
- mutableObj.setField("enumField", TestObjectEnum.A);
- mutableObj.setField("enumArrField", new Enum[] {TestObjectEnum.A});
-
- mutableObj.build();
-
- PortableMetadata metadata = portables().metadata(c.getClass());
-
- assertTrue(metadata.fields().containsAll(Arrays.asList("intField", "intArrField", "arrField", "strField",
- "colField", "mapField", "enumField", "enumArrField")));
-
- assertEquals("int", metadata.fieldTypeName("intField"));
- assertEquals("int[]", metadata.fieldTypeName("intArrField"));
- assertEquals("String[]", metadata.fieldTypeName("arrField"));
- assertEquals("String", metadata.fieldTypeName("strField"));
- assertEquals("Collection", metadata.fieldTypeName("colField"));
- assertEquals("Map", metadata.fieldTypeName("mapField"));
- assertEquals("Enum", metadata.fieldTypeName("enumField"));
- assertEquals("Enum[]", metadata.fieldTypeName("enumArrField"));
- }
-
- /**
- *
- */
- public void testDateInObjectField() {
- TestObjectContainer obj = new TestObjectContainer();
-
- obj.foo = new Date();
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- assertEquals(Timestamp.class, mutableObj.getField("foo").getClass());
- }
-
- /**
- *
- */
- public void testDateInCollection() {
- TestObjectContainer obj = new TestObjectContainer();
-
- obj.foo = Lists.newArrayList(new Date());
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- assertEquals(Timestamp.class, ((List<?>)mutableObj.getField("foo")).get(0).getClass());
- }
-
- /**
- *
- */
- @SuppressWarnings("AssertEqualsBetweenInconvertibleTypes")
- public void testDateArrayOverride() {
- TestObjectContainer obj = new TestObjectContainer();
-
- PortableBuilderImpl mutableObj = wrap(obj);
-
- Date[] arr = {new Date()};
-
- mutableObj.setField("foo", arr);
-
- TestObjectContainer res = mutableObj.build().deserialize();
-
- assertEquals(Date[].class, res.foo.getClass());
- assertTrue(Objects.deepEquals(arr, res.foo));
- }
-
- /**
- *
- */
- public void testChangeMap() {
- AddressBook addrBook = new AddressBook();
-
- addrBook.addCompany(new Company(1, "Google inc", 100, new Address("Saint-Petersburg", "Torzhkovskya", 1, 53), "occupation"));
- addrBook.addCompany(new Company(2, "Apple inc", 100, new Address("Saint-Petersburg", "Torzhkovskya", 1, 54), "occupation"));
- addrBook.addCompany(new Company(3, "Microsoft", 100, new Address("Saint-Petersburg", "Torzhkovskya", 1, 55), "occupation"));
- addrBook.addCompany(new Company(4, "Oracle", 100, new Address("Saint-Petersburg", "Nevskiy", 1, 1), "occupation"));
-
- PortableBuilderImpl mutableObj = wrap(addrBook);
-
- Map<String, List<PortableBuilderImpl>> map = mutableObj.getField("companyByStreet");
-
- List<PortableBuilderImpl> list = map.get("Torzhkovskya");
-
- PortableBuilderImpl company = list.get(0);
-
- assert "Google inc".equals(company.<String>getField("name"));
-
- list.remove(0);
-
- AddressBook res = mutableObj.build().deserialize();
-
- assertEquals(Arrays.asList("Nevskiy", "Torzhkovskya"), new ArrayList<>(res.getCompanyByStreet().keySet()));
-
- List<Company> torzhkovskyaCompanies = res.getCompanyByStreet().get("Torzhkovskya");
-
- assertEquals(2, torzhkovskyaCompanies.size());
- assertEquals("Apple inc", torzhkovskyaCompanies.get(0).name);
- }
-
- /**
- *
- */
- public void testSavingObjectWithNotZeroStart() {
- TestObjectOuter out = new TestObjectOuter();
- TestObjectInner inner = new TestObjectInner();
-
- out.inner = inner;
- inner.outer = out;
-
- PortableBuilderImpl builder = wrap(out);
-
- PortableBuilderImpl innerBuilder = builder.getField("inner");
-
- TestObjectInner res = innerBuilder.build().deserialize();
-
- assertSame(res, res.outer.inner);
- }
-
- /**
- *
- */
- public void testPortableObjectField() {
- TestObjectContainer container = new TestObjectContainer(toPortable(new TestObjectArrayList()));
-
- PortableBuilderImpl wrapper = wrap(container);
-
- assertTrue(wrapper.getField("foo") instanceof PortableObject);
-
- TestObjectContainer deserialized = wrapper.build().deserialize();
- assertTrue(deserialized.foo instanceof PortableObject);
- }
-
- /**
- *
- */
- public void testAssignPortableObject() {
- TestObjectContainer container = new TestObjectContainer();
-
- PortableBuilderImpl wrapper = wrap(container);
-
- wrapper.setField("foo", toPortable(new TestObjectArrayList()));
-
- TestObjectContainer deserialized = wrapper.build().deserialize();
- assertTrue(deserialized.foo instanceof TestObjectArrayList);
- }
-
- /**
- *
- */
- public void testRemoveFromNewObject() {
- PortableBuilderImpl wrapper = newWrapper(TestObjectAllTypes.class);
-
- wrapper.setField("str", "a");
-
- wrapper.removeField("str");
-
- assertNull(wrapper.build().<TestObjectAllTypes>deserialize().str);
- }
-
- /**
- *
- */
- public void testRemoveFromExistingObject() {
- TestObjectAllTypes obj = new TestObjectAllTypes();
- obj.setDefaultData();
-
- PortableBuilderImpl wrapper = wrap(toPortable(obj));
-
- wrapper.removeField("str");
-
- assertNull(wrapper.build().<TestObjectAllTypes>deserialize().str);
- }
-
- /**
- *
- */
- public void testCyclicArrays() {
- TestObjectContainer obj = new TestObjectContainer();
-
- Object[] arr1 = new Object[1];
- Object[] arr2 = new Object[] {arr1};
-
- arr1[0] = arr2;
-
- obj.foo = arr1;
-
- TestObjectContainer res = toPortable(obj).deserialize();
-
- Object[] resArr = (Object[])res.foo;
-
- assertSame(((Object[])resArr[0])[0], resArr);
- }
-
- /**
- *
- */
- @SuppressWarnings("TypeMayBeWeakened")
- public void testCyclicArrayList() {
- TestObjectContainer obj = new TestObjectContainer();
-
- List<Object> arr1 = new ArrayList<>();
- List<Object> arr2 = new ArrayList<>();
-
- arr1.add(arr2);
- arr2.add(arr1);
-
- obj.foo = arr1;
-
- TestObjectContainer res = toPortable(obj).deserialize();
-
- List<?> resArr = (List<?>)res.foo;
-
- assertSame(((List<Object>)resArr.get(0)).get(0), resArr);
- }
-
- /**
- * @param obj Object.
- * @return Object in portable format.
- */
- private PortableObject toPortable(Object obj) {
- return portables().toPortable(obj);
- }
-
- /**
- * @param obj Object.
- * @return GridMutablePortableObject.
- */
- private PortableBuilderImpl wrap(Object obj) {
- return PortableBuilderImpl.wrap(toPortable(obj));
- }
-
- /**
- * @param aCls Class.
- * @return Wrapper.
- */
- private PortableBuilderImpl newWrapper(Class<?> aCls) {
- CacheObjectPortableProcessorImpl processor = (CacheObjectPortableProcessorImpl)(
- (IgnitePortablesImpl)portables()).processor();
-
- return new PortableBuilderImpl(processor.portableContext(), processor.typeId(aCls.getName()),
- aCls.getSimpleName());
- }
-}
\ No newline at end of file
[43/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c257e070
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c257e070
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c257e070
Branch: refs/heads/ignite-1093-2
Commit: c257e070b1fcf29de4ac7192f8873c4e422b5d7e
Parents: a81cce7 2aa292c
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 15:55:17 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 15:55:17 2015 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsFileWorkerBatch.java | 15 ++++-
.../processors/igfs/IgfsAbstractSelfTest.java | 60 +++++++++-----------
.../igfs/IgfsDualAbstractSelfTest.java | 10 +++-
.../testsuites/IgniteHadoopTestSuite.java | 6 +-
4 files changed, 52 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[31/50] [abbrv] ignite git commit: removed link to
IgniteCache.withKeepPortable() method in documentation
Posted by sb...@apache.org.
removed link to IgniteCache.withKeepPortable() method in documentation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eb7d2b0b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eb7d2b0b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eb7d2b0b
Branch: refs/heads/ignite-1093-2
Commit: eb7d2b0b1fe88ce82af43f3bcb7420f2bfcfb638
Parents: dc44a2a
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Sep 15 12:25:41 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Sep 15 12:25:41 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/portable/api/IgnitePortables.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb7d2b0b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
index 56f3768..6a534e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
@@ -51,7 +51,7 @@ import org.jetbrains.annotations.Nullable;
* (assuming that class definitions are present in the classpath).
* <p>
* To work with the portable format directly, user should create a special cache projection
- * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
+ * using IgniteCache.withKeepPortable() method and then retrieve individual fields as needed:
* <pre name=code class=java>
* IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
*
[30/50] [abbrv] ignite git commit: IGNITE-1477: Fixed.
Posted by sb...@apache.org.
IGNITE-1477: Fixed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc44a2a7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc44a2a7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc44a2a7
Branch: refs/heads/ignite-1093-2
Commit: dc44a2a78ce90f5fcab82c0b39d6888724778181
Parents: c0e1ac1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 10:42:15 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 10:42:15 2015 +0300
----------------------------------------------------------------------
.../internal/processors/hadoop/igfs/HadoopIgfsWrapper.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc44a2a7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
index 01189f7..857db71 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
@@ -79,7 +79,7 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
* @param log Current logger.
*/
public HadoopIgfsWrapper(String authority, String logDir, Configuration conf, Log log, String user)
- throws IOException {
+ throws IOException {
try {
this.authority = authority;
this.endpoint = new HadoopIgfsEndpoint(authority);
@@ -351,7 +351,9 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
return curDelegate;
// 2. Guess that we are in the same VM.
- if (!parameter(conf, PARAM_IGFS_ENDPOINT_NO_EMBED, authority, false)) {
+ boolean skipInProc = parameter(conf, PARAM_IGFS_ENDPOINT_NO_EMBED, authority, false);
+
+ if (!skipInProc) {
IgfsEx igfs = null;
if (endpoint.grid() == null) {
@@ -471,7 +473,7 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
return curDelegate;
}
else {
- SB errMsg = new SB("Failed to connect to IGFS [endpoint=" + authority + ", attempts=[");
+ SB errMsg = new SB("Failed to connect to IGFS [endpoint=igfs://" + authority + ", attempts=[");
if (errShmem != null)
errMsg.a("[type=SHMEM, port=" + endpoint.port() + ", err=" + errShmem + "], ");
[25/50] [abbrv] ignite git commit: IGNITE-1378 - Fixed exception
handling in GridContinuousProcessor.startRoutine()
Posted by sb...@apache.org.
IGNITE-1378 - Fixed exception handling in GridContinuousProcessor.startRoutine()
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1914c021
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1914c021
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1914c021
Branch: refs/heads/ignite-1093-2
Commit: 1914c0216608dc8eecf97fb3ee4bdfb6fdec740c
Parents: f8b798d
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Sep 14 23:37:26 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Sep 14 23:37:26 2015 -0700
----------------------------------------------------------------------
.../continuous/GridContinuousProcessor.java | 22 +++++++-------------
1 file changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1914c021/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 3dcfff8..18c1f36 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -566,30 +566,22 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
startFuts.put(routineId, fut);
try {
+ if (locIncluded && registerHandler(ctx.localNodeId(), routineId, hnd, bufSize, interval, autoUnsubscribe, true))
+ hnd.onListenerRegistered(routineId, ctx);
+
ctx.discovery().sendCustomEvent(new StartRoutineDiscoveryMessage(routineId, reqData));
}
- catch (IgniteCheckedException e) { // Marshaller exception may occurs if user pass unmarshallable filter.
+ catch (IgniteCheckedException e) {
startFuts.remove(routineId);
-
locInfos.remove(routineId);
+ unregisterHandler(routineId, hnd, true);
+
fut.onDone(e);
return fut;
}
- // Register local handler if needed.
- if (locIncluded) {
- try {
- if (registerHandler(ctx.localNodeId(), routineId, hnd, bufSize, interval, autoUnsubscribe, true))
- hnd.onListenerRegistered(routineId, ctx);
- }
- catch (IgniteCheckedException e) {
- return new GridFinishedFuture<>(
- new IgniteCheckedException("Failed to register handler locally: " + hnd, e));
- }
- }
-
// Handler is registered locally.
fut.onLocalRegistered();
@@ -1624,4 +1616,4 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
return S.toString(SyncMessageAckFuture.class, this);
}
}
-}
\ No newline at end of file
+}
[14/50] [abbrv] ignite git commit: Minor docs improvement.
Posted by sb...@apache.org.
Minor docs improvement.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c01313d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c01313d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c01313d4
Branch: refs/heads/ignite-1093-2
Commit: c01313d4609bb9a4209e2026b24b09df12935d75
Parents: a0cd9af
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Sep 14 17:33:37 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 14 17:33:37 2015 +0300
----------------------------------------------------------------------
.../processors/platform/services/PlatformAbstractService.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c01313d4/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
index dd5c28a..0b9ee53 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
@@ -212,9 +212,8 @@ public abstract class PlatformAbstractService implements PlatformService, Extern
@SuppressWarnings("UnusedDeclaration")
@IgniteInstanceResource
public void setIgniteInstance(Ignite ignite) {
- platformCtx = ignite != null
- ? PlatformUtils.platformContext(ignite)
- : null;
+ // Ignite instance can be null here because service processor invokes "cleanup" on resource manager.
+ platformCtx = ignite != null ? PlatformUtils.platformContext(ignite) : null;
}
/** {@inheritDoc} */
[45/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.4'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/277b76d7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/277b76d7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/277b76d7
Branch: refs/heads/ignite-1093-2
Commit: 277b76d7a0c244f7f1ecba018f55f584027fadfa
Parents: c1ac19d 6e19979
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 16:08:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 16:08:12 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 10 +-
.../dht/GridClientPartitionTopology.java | 104 +++++++++++--------
.../dht/GridDhtPartitionTopology.java | 4 +-
.../dht/GridDhtPartitionTopologyImpl.java | 7 +-
.../ignite/internal/util/IgniteUtils.java | 16 +++
5 files changed, 87 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
[20/50] [abbrv] ignite git commit: IGNITE-1197 - Reverted fix.
Posted by sb...@apache.org.
IGNITE-1197 - Reverted fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c70680a8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c70680a8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c70680a8
Branch: refs/heads/ignite-1093-2
Commit: c70680a8be837258ae3e10d034f1a53522d6f0f8
Parents: cb9b766
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 18:53:29 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 18:53:29 2015 -0700
----------------------------------------------------------------------
.../distributed/dht/GridDhtLocalPartition.java | 62 ++++++--------------
1 file changed, 19 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c70680a8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index a58451f..c5f15cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -708,62 +708,38 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
return new Iterator<GridDhtCacheEntry>() {
/** */
- private GridDhtCacheEntry lastEntry;
+ GridDhtCacheEntry lastEntry;
- {
- lastEntry = advance();
+ @Override public boolean hasNext() {
+ return it.hasNext();
}
- private GridDhtCacheEntry advance() {
- if (it.hasNext()) {
- Map.Entry<byte[], GridCacheSwapEntry> entry = it.next();
-
- byte[] keyBytes = entry.getKey();
+ @Override public GridDhtCacheEntry next() {
+ Map.Entry<byte[], GridCacheSwapEntry> entry = it.next();
- while (true) {
- try {
- KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
+ byte[] keyBytes = entry.getKey();
- lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
+ while (true) {
+ try {
+ KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
- lastEntry.unswap(true);
+ lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
- return lastEntry;
- }
- catch (GridCacheEntryRemovedException e) {
- if (log.isDebugEnabled())
- log.debug("Got removed entry: " + lastEntry);
- }
- catch (IgniteCheckedException e) {
- throw new CacheException(e);
- }
- catch (GridDhtInvalidPartitionException e) {
- if (log.isDebugEnabled())
- log.debug("Got invalid partition exception: " + e);
+ lastEntry.unswap(true);
- return null;
- }
+ return lastEntry;
+ }
+ catch (GridCacheEntryRemovedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Got removed entry: " + lastEntry);
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
}
}
-
- return null;
- }
-
- @Override public boolean hasNext() {
- return lastEntry != null;
- }
-
- @Override public GridDhtCacheEntry next() {
- if (lastEntry == null)
- throw new NoSuchElementException();
-
- return lastEntry;
}
@Override public void remove() {
- if (lastEntry == null)
- throw new NoSuchElementException();
-
map.remove(lastEntry.key(), lastEntry);
}
};
[38/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.4'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/403601b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/403601b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/403601b5
Branch: refs/heads/ignite-1093-2
Commit: 403601b52a9a4a8f37b33b1ee7472612424a3d2f
Parents: a4d2f2f 367d805
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 15:21:48 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 15:21:48 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
examples/config/filesystem/README.txt | 2 +-
examples/config/filesystem/example-igfs.xml | 7 -
.../internal/portable/api/IgnitePortables.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 21 +-
.../processors/cache/GridCacheMapEntry.java | 15 +-
.../processors/cache/GridCacheProcessor.java | 19 +-
.../processors/cache/GridCacheSwapManager.java | 46 +++--
.../GridDistributedTxRemoteAdapter.java | 8 +-
.../dht/GridDhtPartitionTopologyImpl.java | 9 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 3 +
.../near/GridNearTxFinishFuture.java | 32 ++-
.../cache/transactions/IgniteTxHandler.java | 9 +-
.../util/offheap/GridOffHeapEvictListener.java | 2 +-
.../util/offheap/GridOffHeapPartitionedMap.java | 1 +
.../util/offheap/unsafe/GridUnsafeMap.java | 4 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 7 +-
.../GridCacheAbstractRemoveFailureTest.java | 199 +++++++++++++------
.../cache/GridCacheMemoryModeSelfTest.java | 9 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 60 ++++++
.../cache/IgniteCacheCreateRestartSelfTest.java | 106 ++++++++++
.../IgniteCacheEntryProcessorNodeJoinTest.java | 73 +++++++
.../GridCacheAbstractNodeRestartSelfTest.java | 149 ++++++++++++--
.../GridCacheDhtAtomicRemoveFailureTest.java | 16 +-
.../dht/GridCacheDhtRemoveFailureTest.java | 16 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 2 +-
.../IgniteCacheCrossCacheTxFailoverTest.java | 53 +++--
.../IgniteCachePutRetryAbstractSelfTest.java | 166 ++++++++++++++--
.../dht/IgniteCachePutRetryAtomicSelfTest.java | 2 +
...gniteCachePutRetryTransactionalSelfTest.java | 50 +++--
...eAtomicInvalidPartitionHandlingSelfTest.java | 98 +++++++--
...tomicPrimaryWriteOrderRemoveFailureTest.java | 15 +-
.../GridCacheAtomicRemoveFailureTest.java | 15 +-
.../GridCacheAtomicNearRemoveFailureTest.java | 15 +-
...cPrimaryWriteOrderNearRemoveFailureTest.java | 15 +-
.../near/GridCacheNearRemoveFailureTest.java | 15 +-
.../GridCachePartitionedNodeRestartTest.java | 9 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 9 +-
.../GridCacheReplicatedNodeRestartSelfTest.java | 8 +-
.../offheap/GridOffHeapMapAbstractSelfTest.java | 6 +-
...idOffHeapPartitionedMapAbstractSelfTest.java | 10 +-
.../ignite/testframework/GridTestUtils.java | 117 +++++++++++
.../IgniteCacheFailoverTestSuite.java | 6 -
.../IgniteCacheFailoverTestSuite3.java | 62 ++++++
.../testsuites/IgniteCacheRestartTestSuite.java | 15 +-
.../IgniteCacheRestartTestSuite2.java | 47 +++++
.../hadoop/igfs/HadoopIgfsWrapper.java | 100 ++++++----
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 31 ++-
...QueryOffheapEvictsMultiThreadedSelfTest.java | 5 -
...lientQueryReplicatedNodeRestartSelfTest.java | 8 +-
.../IgniteCacheQueryNodeRestartSelfTest.java | 4 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 8 +-
53 files changed, 1348 insertions(+), 361 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/403601b5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
[36/50] [abbrv] ignite git commit: ignite-1400 Concurrent cache/node
stop
Posted by sb...@apache.org.
ignite-1400 Concurrent cache/node stop
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/91dd7c1c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/91dd7c1c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/91dd7c1c
Branch: refs/heads/ignite-1093-2
Commit: 91dd7c1cadfd70da8223a2755c2daf915ed69183
Parents: f977613
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 14:26:33 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 14:26:33 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 19 +++-
.../cache/IgniteCacheCreateRestartSelfTest.java | 106 +++++++++++++++++++
.../testsuites/IgniteCacheRestartTestSuite.java | 3 +
3 files changed, 126 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/91dd7c1c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 59bb5f7..4317f70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -936,6 +936,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
@Override public void onKernalStop(boolean cancel) {
cacheStartedLatch.countDown();
+ GridCachePartitionExchangeManager<Object, Object> exch = context().exchange();
+
+ // Stop exchange manager first so that we call onKernalStop on all caches.
+ // No new caches should be added after this point.
+ exch.onKernalStop(cancel);
+
for (String cacheName : stopSeq) {
GridCacheAdapter<?, ?> cache = caches.remove(maskNull(cacheName));
@@ -962,7 +968,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
it.hasPrevious();) {
GridCacheSharedManager<?, ?> mgr = it.previous();
- mgr.onKernalStop(cancel);
+ if (mgr != exch)
+ mgr.onKernalStop(cancel);
}
}
@@ -2379,7 +2386,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (ctx.localNodeId().equals(req.initiatingNodeId())) {
fut = (DynamicCacheStartFuture)pendingFuts.get(maskNull(req.cacheName()));
- if (!req.deploymentId().equals(fut.deploymentId()))
+ if (fut != null && !req.deploymentId().equals(fut.deploymentId()))
fut = null;
}
@@ -3101,6 +3108,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*/
public void cancelUserOperations() {
sharedCtx.mvcc().cancelClientFutures();
+
+ Exception err = new IgniteCheckedException("Operation has been cancelled (node is stopping).");
+
+ for (IgniteInternalFuture fut : pendingFuts.values())
+ ((GridFutureAdapter)fut).onDone(err);
+
+ for (IgniteInternalFuture fut : pendingTemplateFuts.values())
+ ((GridFutureAdapter)fut).onDone(err);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/91dd7c1c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCreateRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCreateRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCreateRestartSelfTest.java
new file mode 100644
index 0000000..0a2d778
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCreateRestartSelfTest.java
@@ -0,0 +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.processors.cache;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgniteCacheCreateRestartSelfTest extends GridCommonAbstractTest {
+ /** Cache name. */
+ private static final String CACHE_NAME = "partitioned";
+
+ /** IP finder. */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int NODES = 4;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setPeerClassLoadingEnabled(false);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 5 * 60_000;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopOriginatingNode() throws Exception {
+ startGrids(NODES);
+
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ for (int i = 0; i < 50; i++) {
+ int node = rnd.nextInt(0, NODES);
+
+ final Ignite ignite = ignite(node);
+
+ info("Running iteration on the node [idx=" + node + ", nodeId=" + ignite.cluster().localNode().id() + ']');
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ Thread.currentThread().setName("create-thread");
+
+ try {
+ ignite.createCache(new CacheConfiguration<>(CACHE_NAME));
+ }
+ catch (CacheException | IllegalStateException e) {
+ log.info("Expected error: " + e);
+ }
+
+ return null;
+ }
+ });
+
+ ignite.close();
+
+ fut.get();
+
+ Ignite ignite0 = startGrid(node);
+
+ ignite0.destroyCache(CACHE_NAME);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/91dd7c1c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index 34ef79b..a6bd785 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -18,6 +18,7 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.IgniteCacheCreateRestartSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledOptimisticTxNodeRestartTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedNodeRestartTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedOptimisticTxNodeRestartTest;
@@ -39,6 +40,8 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
suite.addTestSuite(GridCachePartitionedNearDisabledOptimisticTxNodeRestartTest.class);
+ suite.addTestSuite(IgniteCacheCreateRestartSelfTest.class);
+
return suite;
}
}
\ No newline at end of file
[17/50] [abbrv] ignite git commit: IGNITE-1239 - Added test for
reopened ticket.
Posted by sb...@apache.org.
IGNITE-1239 - Added test for reopened ticket.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/866fb415
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/866fb415
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/866fb415
Branch: refs/heads/ignite-1093-2
Commit: 866fb41525957555231fca11c5853731b9473170
Parents: 06fdd7d
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 16:09:37 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 16:09:37 2015 -0700
----------------------------------------------------------------------
...CacheScanPartitionQueryFallbackSelfTest.java | 105 ++++++++++++++++++-
1 file changed, 104 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/866fb415/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index cb3a3bf..df310b4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -26,13 +26,19 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.Cache;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -48,6 +54,7 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteInClosure;
@@ -67,7 +74,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
private static final int GRID_CNT = 3;
/** Keys count. */
- private static final int KEYS_CNT = 5000;
+ private static final int KEYS_CNT = 50 * RendezvousAffinityFunction.DFLT_PARTITION_COUNT;
/** Ip finder. */
private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
@@ -261,6 +268,79 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
}
/**
+ * Scan should activate fallback mechanism when new nodes join topology and rebalancing happens in parallel with
+ * scan query.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanFallbackOnRebalancingCursor() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1239");
+
+ cacheMode = CacheMode.PARTITIONED;
+ clientMode = false;
+ backups = 1;
+ commSpiFactory = new TestFallbackOnRebalancingCommunicationSpiFactory();
+
+ try {
+ Ignite ignite = startGrids(GRID_CNT);
+
+ fillCache(ignite);
+
+ final AtomicBoolean done = new AtomicBoolean(false);
+
+ IgniteInternalFuture fut1 = multithreadedAsync(
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ for (int i = 0; i < 5; i++) {
+ startGrid(GRID_CNT + i);
+
+ U.sleep(500);
+ }
+
+ done.set(true);
+
+ return null;
+ }
+ }, 1);
+
+ final AtomicInteger nodeIdx = new AtomicInteger();
+
+ IgniteInternalFuture fut2 = multithreadedAsync(
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ int nodeId = nodeIdx.getAndIncrement();
+
+ IgniteCache<Integer, Integer> cache = grid(nodeId).cache(null);
+
+ while (!done.get()) {
+ int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
+
+ try {
+ QueryCursor<Cache.Entry<Integer, Integer>> cur =
+ cache.query(new ScanQuery<Integer, Integer>(part));
+
+ U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']');
+
+ doTestScanQueryCursor(cur, part);
+ }
+ catch (ClusterGroupEmptyCheckedException e) {
+ log.warning("Invalid partition: " + part, e);
+ }
+ }
+
+ return null;
+ }
+ }, GRID_CNT);
+
+ fut1.get();
+ fut2.get();
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
* Scan should try first remote node and fallbacks to second remote node.
*
* @throws Exception If failed.
@@ -391,6 +471,29 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
}
/**
+ * @param cur Query cursor.
+ * @param part Partition number.
+ */
+ protected void doTestScanQueryCursor(
+ QueryCursor<Cache.Entry<Integer, Integer>> cur, int part) throws IgniteCheckedException {
+
+ Map<Integer, Integer> map = entries.get(part);
+
+ assert map != null;
+
+ int cnt = 0;
+
+ for (Cache.Entry<Integer, Integer> e : cur) {
+
+ assertEquals(map.get(e.getKey()), e.getValue());
+
+ cnt++;
+ }
+
+ assertEquals("Invalid number of entries for partition: " + part, map.size(), cnt);
+ }
+
+ /**
* @param cctx Cctx.
*/
private static int anyLocalPartition(GridCacheContext<?, ?> cctx) {
[06/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
deleted file mode 100644
index 05df23b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.portable;
-
-import java.util.Arrays;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Test for disabled meta data.
- */
-public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest {
- /** */
- private PortableMarshaller marsh;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /**
- * @return Portables.
- */
- private IgnitePortables portables() {
- return grid().portables();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDisableGlobal() throws Exception {
- marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(
- TestObject1.class.getName(),
- TestObject2.class.getName()
- ));
-
- marsh.setMetaDataEnabled(false);
-
- try {
- startGrid();
-
- portables().toPortable(new TestObject1());
- portables().toPortable(new TestObject2());
- portables().toPortable(new TestObject3());
-
- assertEquals(0, portables().metadata(TestObject1.class).fields().size());
- assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-
- PortableBuilder bldr = portables().builder("FakeType");
-
- bldr.setField("field1", 0).setField("field2", "value").build();
-
- assertNull(portables().metadata("FakeType"));
- assertNull(portables().metadata(TestObject3.class));
- }
- finally {
- stopGrid();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDisableGlobalSimpleClass() throws Exception {
- marsh = new PortableMarshaller();
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject2.class.getName());
-
- typeCfg.setMetaDataEnabled(true);
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(TestObject1.class.getName()),
- typeCfg
- ));
-
- marsh.setMetaDataEnabled(false);
-
- try {
- startGrid();
-
- portables().toPortable(new TestObject1());
- portables().toPortable(new TestObject2());
-
- assertEquals(0, portables().metadata(TestObject1.class).fields().size());
- assertEquals(1, portables().metadata(TestObject2.class).fields().size());
- }
- finally {
- stopGrid();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDisableGlobalMarshalAwareClass() throws Exception {
- marsh = new PortableMarshaller();
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject1.class.getName());
-
- typeCfg.setMetaDataEnabled(true);
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(TestObject2.class.getName()),
- typeCfg
- ));
-
- marsh.setMetaDataEnabled(false);
-
- try {
- startGrid();
-
- portables().toPortable(new TestObject1());
- portables().toPortable(new TestObject2());
-
- assertEquals(1, portables().metadata(TestObject1.class).fields().size());
- assertEquals(0, portables().metadata(TestObject2.class).fields().size());
- }
- finally {
- stopGrid();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDisableSimpleClass() throws Exception {
- marsh = new PortableMarshaller();
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject1.class.getName());
-
- typeCfg.setMetaDataEnabled(false);
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(TestObject2.class.getName()),
- typeCfg
- ));
-
- try {
- startGrid();
-
- portables().toPortable(new TestObject1());
- portables().toPortable(new TestObject2());
-
- assertEquals(0, portables().metadata(TestObject1.class).fields().size());
- assertEquals(1, portables().metadata(TestObject2.class).fields().size());
- }
- finally {
- stopGrid();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDisableMarshalAwareClass() throws Exception {
- marsh = new PortableMarshaller();
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject2.class.getName());
-
- typeCfg.setMetaDataEnabled(false);
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(TestObject1.class.getName()),
- typeCfg
- ));
-
- try {
- startGrid();
-
- portables().toPortable(new TestObject1());
- portables().toPortable(new TestObject2());
-
- assertEquals(1, portables().metadata(TestObject1.class).fields().size());
- assertEquals(0, portables().metadata(TestObject2.class).fields().size());
- }
- finally {
- stopGrid();
- }
- }
-
- /**
- */
- @SuppressWarnings("UnusedDeclaration")
- private static class TestObject1 {
- /** */
- private int field;
- }
-
- /**
- */
- private static class TestObject2 implements PortableMarshalAware {
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeInt("field", 1);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- // No-op.
- }
- }
-
- /**
- */
- @SuppressWarnings("UnusedDeclaration")
- private static class TestObject3 {
- /** */
- private int field;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
deleted file mode 100644
index fa3c9a7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
+++ /dev/null
@@ -1,371 +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.math.BigDecimal;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Portable meta data test.
- */
-public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
- /** */
- private static int idx;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- CacheConfiguration ccfg = new CacheConfiguration();
-
- cfg.setCacheConfiguration(ccfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- idx = 0;
-
- startGrid();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopGrid();
- }
-
- /**
- * @return Portables API.
- */
- protected IgnitePortables portables() {
- return grid().portables();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAll() throws Exception {
- portables().toPortable(new TestObject2());
-
- Collection<PortableMetadata> metas = portables().metadata();
-
- assertEquals(2, metas.size());
-
- for (PortableMetadata meta : metas) {
- Collection<String> fields;
-
- switch (meta.typeName()) {
- case "TestObject1":
- fields = meta.fields();
-
- assertEquals(7, fields.size());
-
- assertTrue(fields.contains("intVal"));
- assertTrue(fields.contains("strVal"));
- assertTrue(fields.contains("arrVal"));
- assertTrue(fields.contains("obj1Val"));
- assertTrue(fields.contains("obj2Val"));
- assertTrue(fields.contains("decVal"));
- assertTrue(fields.contains("decArrVal"));
-
- assertEquals("int", meta.fieldTypeName("intVal"));
- assertEquals("String", meta.fieldTypeName("strVal"));
- assertEquals("byte[]", meta.fieldTypeName("arrVal"));
- assertEquals("Object", meta.fieldTypeName("obj1Val"));
- assertEquals("Object", meta.fieldTypeName("obj2Val"));
- assertEquals("decimal", meta.fieldTypeName("decVal"));
- assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-
- break;
-
- case "TestObject2":
- fields = meta.fields();
-
- assertEquals(7, fields.size());
-
- assertTrue(fields.contains("boolVal"));
- assertTrue(fields.contains("dateVal"));
- assertTrue(fields.contains("uuidArrVal"));
- assertTrue(fields.contains("objVal"));
- assertTrue(fields.contains("mapVal"));
- assertTrue(fields.contains("decVal"));
- assertTrue(fields.contains("decArrVal"));
-
- assertEquals("boolean", meta.fieldTypeName("boolVal"));
- assertEquals("Date", meta.fieldTypeName("dateVal"));
- assertEquals("UUID[]", meta.fieldTypeName("uuidArrVal"));
- assertEquals("Object", meta.fieldTypeName("objVal"));
- assertEquals("Map", meta.fieldTypeName("mapVal"));
- assertEquals("decimal", meta.fieldTypeName("decVal"));
- assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-
- break;
-
- default:
- assert false : meta.typeName();
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testNoConfiguration() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1377");
-
- portables().toPortable(new TestObject3());
-
- assertNotNull(portables().metadata(TestObject3.class));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testReflection() throws Exception {
- PortableMetadata meta = portables().metadata(TestObject1.class);
-
- assertNotNull(meta);
-
- assertEquals("TestObject1", meta.typeName());
-
- Collection<String> fields = meta.fields();
-
- assertEquals(7, fields.size());
-
- assertTrue(fields.contains("intVal"));
- assertTrue(fields.contains("strVal"));
- assertTrue(fields.contains("arrVal"));
- assertTrue(fields.contains("obj1Val"));
- assertTrue(fields.contains("obj2Val"));
- assertTrue(fields.contains("decVal"));
- assertTrue(fields.contains("decArrVal"));
-
- assertEquals("int", meta.fieldTypeName("intVal"));
- assertEquals("String", meta.fieldTypeName("strVal"));
- assertEquals("byte[]", meta.fieldTypeName("arrVal"));
- assertEquals("Object", meta.fieldTypeName("obj1Val"));
- assertEquals("Object", meta.fieldTypeName("obj2Val"));
- assertEquals("decimal", meta.fieldTypeName("decVal"));
- assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableMarshalAware() throws Exception {
- portables().toPortable(new TestObject2());
-
- PortableMetadata meta = portables().metadata(TestObject2.class);
-
- assertNotNull(meta);
-
- assertEquals("TestObject2", meta.typeName());
-
- Collection<String> fields = meta.fields();
-
- assertEquals(7, fields.size());
-
- assertTrue(fields.contains("boolVal"));
- assertTrue(fields.contains("dateVal"));
- assertTrue(fields.contains("uuidArrVal"));
- assertTrue(fields.contains("objVal"));
- assertTrue(fields.contains("mapVal"));
- assertTrue(fields.contains("decVal"));
- assertTrue(fields.contains("decArrVal"));
-
- assertEquals("boolean", meta.fieldTypeName("boolVal"));
- assertEquals("Date", meta.fieldTypeName("dateVal"));
- assertEquals("UUID[]", meta.fieldTypeName("uuidArrVal"));
- assertEquals("Object", meta.fieldTypeName("objVal"));
- assertEquals("Map", meta.fieldTypeName("mapVal"));
- assertEquals("decimal", meta.fieldTypeName("decVal"));
- assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMerge() throws Exception {
- portables().toPortable(new TestObject2());
-
- idx = 1;
-
- portables().toPortable(new TestObject2());
-
- PortableMetadata meta = portables().metadata(TestObject2.class);
-
- assertNotNull(meta);
-
- assertEquals("TestObject2", meta.typeName());
-
- Collection<String> fields = meta.fields();
-
- assertEquals(9, fields.size());
-
- assertTrue(fields.contains("boolVal"));
- assertTrue(fields.contains("dateVal"));
- assertTrue(fields.contains("uuidArrVal"));
- assertTrue(fields.contains("objVal"));
- assertTrue(fields.contains("mapVal"));
- assertTrue(fields.contains("charVal"));
- assertTrue(fields.contains("colVal"));
- assertTrue(fields.contains("decVal"));
- assertTrue(fields.contains("decArrVal"));
-
- assertEquals("boolean", meta.fieldTypeName("boolVal"));
- assertEquals("Date", meta.fieldTypeName("dateVal"));
- assertEquals("UUID[]", meta.fieldTypeName("uuidArrVal"));
- assertEquals("Object", meta.fieldTypeName("objVal"));
- assertEquals("Map", meta.fieldTypeName("mapVal"));
- assertEquals("char", meta.fieldTypeName("charVal"));
- assertEquals("Collection", meta.fieldTypeName("colVal"));
- assertEquals("decimal", meta.fieldTypeName("decVal"));
- assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSerializedObject() throws Exception {
- TestObject1 obj = new TestObject1();
-
- obj.intVal = 10;
- obj.strVal = "str";
- obj.arrVal = new byte[] {2, 4, 6};
- obj.obj1Val = null;
- obj.obj2Val = new TestObject2();
- obj.decVal = BigDecimal.ZERO;
- obj.decArrVal = new BigDecimal[] { BigDecimal.ONE };
-
- PortableObject po = portables().toPortable(obj);
-
- info(po.toString());
-
- PortableMetadata meta = po.metaData();
-
- assertNotNull(meta);
-
- assertEquals("TestObject1", meta.typeName());
-
- Collection<String> fields = meta.fields();
-
- assertEquals(7, fields.size());
-
- assertTrue(fields.contains("intVal"));
- assertTrue(fields.contains("strVal"));
- assertTrue(fields.contains("arrVal"));
- assertTrue(fields.contains("obj1Val"));
- assertTrue(fields.contains("obj2Val"));
- assertTrue(fields.contains("decVal"));
- assertTrue(fields.contains("decArrVal"));
-
- assertEquals("int", meta.fieldTypeName("intVal"));
- assertEquals("String", meta.fieldTypeName("strVal"));
- assertEquals("byte[]", meta.fieldTypeName("arrVal"));
- assertEquals("Object", meta.fieldTypeName("obj1Val"));
- assertEquals("Object", meta.fieldTypeName("obj2Val"));
- assertEquals("decimal", meta.fieldTypeName("decVal"));
- assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
- }
-
- /**
- */
- @SuppressWarnings("UnusedDeclaration")
- private static class TestObject1 {
- /** */
- private int intVal;
-
- /** */
- private String strVal;
-
- /** */
- private byte[] arrVal;
-
- /** */
- private TestObject1 obj1Val;
-
- /** */
- private TestObject2 obj2Val;
-
- /** */
- private BigDecimal decVal;
-
- /** */
- private BigDecimal[] decArrVal;
- }
-
- /**
- */
- private static class TestObject2 implements PortableMarshalAware {
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeBoolean("boolVal", false);
- writer.writeDate("dateVal", new Date());
- writer.writeUuidArray("uuidArrVal", null);
- writer.writeObject("objVal", null);
- writer.writeMap("mapVal", new HashMap<>());
- writer.writeDecimal("decVal", BigDecimal.ZERO);
- writer.writeDecimalArray("decArrVal", new BigDecimal[] { BigDecimal.ONE });
-
- if (idx == 1) {
- writer.writeChar("charVal", (char)0);
- writer.writeCollection("colVal", null);
- }
-
- PortableRawWriter raw = writer.rawWriter();
-
- raw.writeChar((char)0);
- raw.writeCollection(null);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- // No-op.
- }
- }
-
- /**
- */
- @SuppressWarnings("UnusedDeclaration")
- private static class TestObject3 {
- /** */
- private int intVal;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
deleted file mode 100644
index 349f152..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
+++ /dev/null
@@ -1,482 +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 java.util.Map;
-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.PortableIdMapper;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Wildcards test.
- */
-public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest {
- /** */
- private 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;
- }
- };
-
- /**
- * @return Portable context.
- */
- private PortableContext portableContext() {
- return new PortableContext(META_HND, null);
- }
-
- /**
- * @return Portable marshaller.
- */
- private PortableMarshaller portableMarshaller() {
- PortableMarshaller marsh = new PortableMarshaller();
- marsh.setContext(new MarshallerContextTestImpl(null));
-
- return marsh;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClassNames() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setClassNames(Arrays.asList(
- "org.apache.ignite.internal.portable.test.*",
- "unknown.*"
- ));
-
- ctx.configure(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
- assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
- assertTrue(typeIds.containsKey("innerclass".hashCode()));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClassNamesWithMapper() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @SuppressWarnings("IfMayBeConditional")
- @Override public int typeId(String clsName) {
- if (clsName.endsWith("1"))
- return 300;
- else if (clsName.endsWith("2"))
- return 400;
- else if (clsName.endsWith("InnerClass"))
- return 500;
- else
- return -500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setClassNames(Arrays.asList(
- "org.apache.ignite.internal.portable.test.*",
- "unknown.*"
- ));
-
- ctx.configure(marsh);
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
- assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- assertEquals(500, typeMappers.get("InnerClass").typeId("InnerClass"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeConfigurations() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration("org.apache.ignite.internal.portable.test.*"),
- new PortableTypeConfiguration("unknown.*")
- ));
-
- ctx.configure(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
- assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
- assertTrue(typeIds.containsKey("innerclass".hashCode()));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeConfigurationsWithGlobalMapper() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @SuppressWarnings("IfMayBeConditional")
- @Override public int typeId(String clsName) {
- if (clsName.endsWith("1"))
- return 300;
- else if (clsName.endsWith("2"))
- return 400;
- else if (clsName.endsWith("InnerClass"))
- return 500;
- else
- return -500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration("org.apache.ignite.internal.portable.test.*"),
- new PortableTypeConfiguration("unknown.*")
- ));
-
- ctx.configure(marsh);
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
- assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- assertEquals(500, typeMappers.get("InnerClass").typeId("InnerClass"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeConfigurationsWithNonGlobalMapper() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @SuppressWarnings("IfMayBeConditional")
- @Override public int typeId(String clsName) {
- if (clsName.endsWith("1"))
- return 300;
- else if (clsName.endsWith("2"))
- return 400;
- else if (clsName.endsWith("InnerClass"))
- return 500;
- else
- return -500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration("org.apache.ignite.internal.portable.test.*"),
- new PortableTypeConfiguration("unknown.*")
- ));
-
- ctx.configure(marsh);
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
- assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- assertEquals(500, typeMappers.get("InnerClass").typeId("InnerClass"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOverride() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setClassNames(Arrays.asList(
- "org.apache.ignite.internal.portable.test.*"
- ));
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
- typeCfg.setClassName("org.apache.ignite.internal.portable.test.GridPortableTestClass2");
- typeCfg.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 100;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
- ctx.configure(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
- assertTrue(typeIds.containsKey("innerclass".hashCode()));
- assertFalse(typeIds.containsKey("gridportabletestclass2".hashCode()));
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(100, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClassNamesJar() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setClassNames(Arrays.asList(
- "org.apache.ignite.portable.testjar.*",
- "unknown.*"
- ));
-
- ctx.configure(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
- assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClassNamesWithMapperJar() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @SuppressWarnings("IfMayBeConditional")
- @Override public int typeId(String clsName) {
- if (clsName.endsWith("1"))
- return 300;
- else if (clsName.endsWith("2"))
- return 400;
- else
- return -500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setClassNames(Arrays.asList(
- "org.apache.ignite.portable.testjar.*",
- "unknown.*"
- ));
-
- ctx.configure(marsh);
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
- assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeConfigurationsJar() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration("org.apache.ignite.portable.testjar.*"),
- new PortableTypeConfiguration("unknown.*")
- ));
-
- ctx.configure(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
- assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeConfigurationsWithGlobalMapperJar() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @SuppressWarnings("IfMayBeConditional")
- @Override public int typeId(String clsName) {
- if (clsName.endsWith("1"))
- return 300;
- else if (clsName.endsWith("2"))
- return 400;
- else
- return -500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration("org.apache.ignite.portable.testjar.*"),
- new PortableTypeConfiguration("unknown.*")
- ));
-
- ctx.configure(marsh);
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
- assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeConfigurationsWithNonGlobalMapperJar() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @SuppressWarnings("IfMayBeConditional")
- @Override public int typeId(String clsName) {
- if (clsName.endsWith("1"))
- return 300;
- else if (clsName.endsWith("2"))
- return 400;
- else
- return -500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration("org.apache.ignite.portable.testjar.*"),
- new PortableTypeConfiguration("unknown.*")
- ));
-
- ctx.configure(marsh);
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
- assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOverrideJar() throws Exception {
- PortableContext ctx = portableContext();
-
- PortableMarshaller marsh = portableMarshaller();
-
- marsh.setClassNames(Arrays.asList(
- "org.apache.ignite.portable.testjar.*"
- ));
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(
- "org.apache.ignite.portable.testjar.GridPortableTestClass2");
-
- typeCfg.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 100;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
- ctx.configure(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-
- Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
- assertEquals(3, typeMappers.size());
-
- assertEquals(100, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
deleted file mode 100644
index 3244331..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
+++ /dev/null
@@ -1,67 +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.mutabletest;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- *
- */
-public class GridPortableMarshalerAwareTestClass implements PortableMarshalAware {
- /** */
- public String s;
-
- /** */
- public String sRaw;
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeString("s", s);
-
- PortableRawWriter raw = writer.rawWriter();
-
- raw.writeString(sRaw);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- s = reader.readString("s");
-
- PortableRawReader raw = reader.rawReader();
-
- sRaw = raw.readString();
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("FloatingPointEquality")
- @Override public boolean equals(Object other) {
- return this == other || GridTestUtils.deepEquals(this, other);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridPortableMarshalerAwareTestClass.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
deleted file mode 100644
index e49514b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
+++ /dev/null
@@ -1,434 +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.mutabletest;
-
-import com.google.common.base.Throwables;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- *
- */
-@SuppressWarnings({"PublicInnerClass", "PublicField"})
-public class GridPortableTestClasses {
- /**
- *
- */
- public static class TestObjectContainer {
- /** */
- public Object foo;
-
- /**
- *
- */
- public TestObjectContainer() {
- // No-op.
- }
-
- /**
- * @param foo Object.
- */
- public TestObjectContainer(Object foo) {
- this.foo = foo;
- }
- }
-
- /**
- *
- */
- public static class TestObjectOuter {
- /** */
- public TestObjectInner inner;
-
- /** */
- public String foo;
-
- /**
- *
- */
- public TestObjectOuter() {
-
- }
-
- /**
- * @param inner Inner object.
- */
- public TestObjectOuter(TestObjectInner inner) {
- this.inner = inner;
- }
- }
-
- /** */
- public static class TestObjectInner {
- /** */
- public Object foo;
-
- /** */
- public TestObjectOuter outer;
- }
-
- /** */
- public static class TestObjectArrayList {
- /** */
- public List<String> list = new ArrayList<>();
- }
-
- /**
- *
- */
- public static class TestObjectPlainPortable {
- /** */
- public PortableObject plainPortable;
-
- /**
- *
- */
- public TestObjectPlainPortable() {
- // No-op.
- }
-
- /**
- * @param plainPortable Object.
- */
- public TestObjectPlainPortable(PortableObject plainPortable) {
- this.plainPortable = plainPortable;
- }
- }
-
- /**
- *
- */
- public static class TestObjectAllTypes implements Serializable {
- /** */
- public Byte b_;
-
- /** */
- public Short s_;
-
- /** */
- public Integer i_;
-
- /** */
- public Long l_;
-
- /** */
- public Float f_;
-
- /** */
- public Double d_;
-
- /** */
- public Character c_;
-
- /** */
- public Boolean z_;
-
- /** */
- public byte b;
-
- /** */
- public short s;
-
- /** */
- public int i;
-
- /** */
- public long l;
-
- /** */
- public float f;
-
- /** */
- public double d;
-
- /** */
- public char c;
-
- /** */
- public boolean z;
-
- /** */
- public String str;
-
- /** */
- public UUID uuid;
-
- /** */
- public Date date;
-
- /** */
- public byte[] bArr;
-
- /** */
- public short[] sArr;
-
- /** */
- public int[] iArr;
-
- /** */
- public long[] lArr;
-
- /** */
- public float[] fArr;
-
- /** */
- public double[] dArr;
-
- /** */
- public char[] cArr;
-
- /** */
- public boolean[] zArr;
-
- /** */
- public BigDecimal[] bdArr;
-
- /** */
- public String[] strArr;
-
- /** */
- public UUID[] uuidArr;
-
- /** */
- public Date[] dateArr;
-
- /** */
- public TestObjectEnum anEnum;
-
- /** */
- public TestObjectEnum[] enumArr;
-
- /** */
- public Map.Entry entry;
-
- /**
- * @return Array.
- */
- private byte[] serialize() {
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
-
- try {
- ObjectOutput out = new ObjectOutputStream(byteOut);
-
- out.writeObject(this);
-
- out.close();
- }
- catch (IOException e) {
- Throwables.propagate(e);
- }
-
- return byteOut.toByteArray();
- }
-
- /**
- *
- */
- public void setDefaultData() {
- b_ = 11;
- s_ = 22;
- i_ = 33;
- l_ = 44L;
- f_ = 55f;
- d_ = 66d;
- c_ = 'e';
- z_ = true;
-
- b = 1;
- s = 2;
- i = 3;
- l = 4;
- f = 5;
- d = 6;
- c = 7;
- z = true;
-
- str = "abc";
- uuid = new UUID(1, 1);
- date = new Date(1000000);
-
- bArr = new byte[] {1, 2, 3};
- sArr = new short[] {1, 2, 3};
- iArr = new int[] {1, 2, 3};
- lArr = new long[] {1, 2, 3};
- fArr = new float[] {1, 2, 3};
- dArr = new double[] {1, 2, 3};
- cArr = new char[] {1, 2, 3};
- zArr = new boolean[] {true, false};
-
- strArr = new String[] {"abc", "ab", "a"};
- uuidArr = new UUID[] {new UUID(1, 1), new UUID(2, 2)};
- bdArr = new BigDecimal[] {new BigDecimal(1000), BigDecimal.TEN};
- dateArr = new Date[] {new Date(1000000), new Date(200000)};
-
- anEnum = TestObjectEnum.A;
-
- enumArr = new TestObjectEnum[] {TestObjectEnum.B};
-
- entry = new GridMapEntry<>(1, "a");
- }
- }
-
- /**
- *
- */
- public enum TestObjectEnum {
- A, B, C
- }
-
- /**
- *
- */
- public static class Address {
- /** City. */
- public String city;
-
- /** Street. */
- public String street;
-
- /** Street number. */
- public int streetNumber;
-
- /** Flat number. */
- public int flatNumber;
-
- /**
- * Default constructor.
- */
- public Address() {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param city City.
- * @param street Street.
- * @param streetNumber Street number.
- * @param flatNumber Flat number.
- */
- public Address(String city, String street, int streetNumber, int flatNumber) {
- this.city = city;
- this.street = street;
- this.streetNumber = streetNumber;
- this.flatNumber = flatNumber;
- }
- }
-
- /**
- *
- */
- public static class Company {
- /** ID. */
- public int id;
-
- /** Name. */
- public String name;
-
- /** Size. */
- public int size;
-
- /** Address. */
- public Address address;
-
- /** Occupation. */
- public String occupation;
-
- /**
- * Default constructor.
- */
- public Company() {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param id ID.
- * @param name Name.
- * @param size Size.
- * @param address Address.
- * @param occupation Occupation.
- */
- public Company(int id, String name, int size, Address address, String occupation) {
- this.id = id;
- this.name = name;
- this.size = size;
- this.address = address;
- this.occupation = occupation;
- }
- }
-
- /**
- *
- */
- public static class AddressBook {
- /** */
- private Map<String, List<Company>> companyByStreet = new TreeMap<>();
-
- /**
- * @param street Street.
- * @return Company.
- */
- public List<Company> findCompany(String street) {
- return companyByStreet.get(street);
- }
-
- /**
- * @param company Company.
- */
- public void addCompany(Company company) {
- List<Company> list = companyByStreet.get(company.address.street);
-
- if (list == null) {
- list = new ArrayList<>();
-
- companyByStreet.put(company.address.street, list);
- }
-
- list.add(company);
- }
-
- /**
- * @return map
- */
- public Map<String, List<Company>> getCompanyByStreet() {
- return companyByStreet;
- }
-
- /**
- * @param companyByStreet map
- */
- public void setCompanyByStreet(Map<String, List<Company>> companyByStreet) {
- this.companyByStreet = companyByStreet;
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java
deleted file mode 100644
index daa13d5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable.mutabletest;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java
deleted file mode 100644
index 26897e6..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java
deleted file mode 100644
index 05a8c33..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java
+++ /dev/null
@@ -1,28 +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.test;
-
-/**
- */
-public class GridPortableTestClass1 {
- /**
- */
- private static class InnerClass {
- // No-op.
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java
deleted file mode 100644
index ba69991..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java
+++ /dev/null
@@ -1,24 +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.test;
-
-/**
- */
-public class GridPortableTestClass2 {
- // No-op.
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java
deleted file mode 100644
index e63b814..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable.test;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java
deleted file mode 100644
index cf3aa2d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java
+++ /dev/null
@@ -1,24 +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.test.subpackage;
-
-/**
- */
-public class GridPortableTestClass3 {
- // No-op.
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java
deleted file mode 100644
index ae8ee73..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable.test.subpackage;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
deleted file mode 100644
index 1ba3d4d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
+++ /dev/null
@@ -1,295 +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.processors.cache.portable;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.util.lang.GridAbsPredicate;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- *
- */
-public class GridCacheClientNodePortableMetadataMultinodeTest extends GridCommonAbstractTest {
- /** */
- protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private boolean client;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setPeerClassLoadingEnabled(false);
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder).setForceServerMode(true);
-
- cfg.setMarshaller(new PortableMarshaller());
-
- CacheConfiguration ccfg = new CacheConfiguration();
-
- ccfg.setWriteSynchronizationMode(FULL_SYNC);
-
- cfg.setCacheConfiguration(ccfg);
-
- cfg.setClientMode(client);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
-
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClientMetadataInitialization() throws Exception {
- startGrids(2);
-
- final AtomicBoolean stop = new AtomicBoolean();
-
- final ConcurrentHashSet<String> allTypes = new ConcurrentHashSet<>();
-
- IgniteInternalFuture<?> fut;
-
- try {
- // Update portable metadata concurrently with client nodes start.
- fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
- @Override public Object call() throws Exception {
- IgnitePortables portables = ignite(0).portables();
-
- IgniteCache<Object, Object> cache = ignite(0).cache(null).withKeepPortable();
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- for (int i = 0; i < 1000; i++) {
- log.info("Iteration: " + i);
-
- String type = "portable-type-" + i;
-
- allTypes.add(type);
-
- for (int f = 0; f < 10; f++) {
- PortableBuilder builder = portables.builder(type);
-
- String fieldName = "f" + f;
-
- builder.setField(fieldName, i);
-
- cache.put(rnd.nextInt(0, 100_000), builder.build());
-
- if (f % 100 == 0)
- log.info("Put iteration: " + f);
- }
-
- if (stop.get())
- break;
- }
-
- return null;
- }
- }, 5, "update-thread");
- }
- finally {
- stop.set(true);
- }
-
- client = true;
-
- startGridsMultiThreaded(2, 5);
-
- fut.get();
-
- assertFalse(allTypes.isEmpty());
-
- log.info("Expected portable types: " + allTypes.size());
-
- assertEquals(7, ignite(0).cluster().nodes().size());
-
- for (int i = 0; i < 7; i++) {
- log.info("Check metadata on node: " + i);
-
- boolean client = i > 1;
-
- assertEquals((Object)client, ignite(i).configuration().isClientMode());
-
- IgnitePortables portables = ignite(i).portables();
-
- Collection<PortableMetadata> metaCol = portables.metadata();
-
- assertEquals(allTypes.size(), metaCol.size());
-
- Set<String> names = new HashSet<>();
-
- for (PortableMetadata meta : metaCol) {
- assertTrue(names.add(meta.typeName()));
-
- assertNull(meta.affinityKeyFieldName());
-
- assertEquals(10, meta.fields().size());
- }
-
- assertEquals(allTypes.size(), names.size());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFailoverOnStart() throws Exception {
- startGrids(4);
-
- IgnitePortables portables = ignite(0).portables();
-
- IgniteCache<Object, Object> cache = ignite(0).cache(null).withKeepPortable();
-
- for (int i = 0; i < 1000; i++) {
- PortableBuilder builder = portables.builder("type-" + i);
-
- builder.setField("f0", i);
-
- cache.put(i, builder.build());
- }
-
- client = true;
-
- final CyclicBarrier barrier = new CyclicBarrier(6);
-
- final AtomicInteger startIdx = new AtomicInteger(4);
-
- IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
- @Override public Object call() throws Exception {
- barrier.await();
-
- Ignite ignite = startGrid(startIdx.getAndIncrement());
-
- assertTrue(ignite.configuration().isClientMode());
-
- log.info("Started node: " + ignite.name());
-
- return null;
- }
- }, 5, "start-thread");
-
- barrier.await();
-
- U.sleep(ThreadLocalRandom.current().nextInt(10, 100));
-
- for (int i = 0; i < 3; i++)
- stopGrid(i);
-
- fut.get();
-
- assertEquals(6, ignite(3).cluster().nodes().size());
-
- for (int i = 3; i < 7; i++) {
- log.info("Check metadata on node: " + i);
-
- boolean client = i > 3;
-
- assertEquals((Object) client, ignite(i).configuration().isClientMode());
-
- portables = ignite(i).portables();
-
- final IgnitePortables p0 = portables;
-
- GridTestUtils.waitForCondition(new GridAbsPredicate() {
- @Override public boolean apply() {
- Collection<PortableMetadata> metaCol = p0.metadata();
-
- return metaCol.size() == 1000;
- }
- }, getTestTimeout());
-
- Collection<PortableMetadata> metaCol = portables.metadata();
-
- assertEquals(1000, metaCol.size());
-
- Set<String> names = new HashSet<>();
-
- for (PortableMetadata meta : metaCol) {
- assertTrue(names.add(meta.typeName()));
-
- assertNull(meta.affinityKeyFieldName());
-
- assertEquals(1, meta.fields().size());
- }
-
- assertEquals(1000, names.size());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClientStartsFirst() throws Exception {
- client = true;
-
- Ignite ignite0 = startGrid(0);
-
- assertTrue(ignite0.configuration().isClientMode());
-
- client = false;
-
- Ignite ignite1 = startGrid(1);
-
- assertFalse(ignite1.configuration().isClientMode());
-
- IgnitePortables portables = ignite(1).portables();
-
- IgniteCache<Object, Object> cache = ignite(1).cache(null).withKeepPortable();
-
- for (int i = 0; i < 100; i++) {
- PortableBuilder builder = portables.builder("type-" + i);
-
- builder.setField("f0", i);
-
- cache.put(i, builder.build());
- }
-
- assertEquals(100, ignite(0).portables().metadata().size());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java
deleted file mode 100644
index a66d940..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java
+++ /dev/null
@@ -1,286 +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.processors.cache.portable;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-
-/**
- *
- */
-public class GridCacheClientNodePortableMetadataTest extends GridCacheAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 4;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return CacheMode.PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
- typeCfg.setClassName(TestObject1.class.getName());
- typeCfg.setAffinityKeyFieldName("val2");
-
- marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
- if (gridName.equals(getTestGridName(gridCount() - 1)))
- cfg.setClientMode(true);
-
- cfg.setMarshaller(marsh);
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableMetadataOnClient() throws Exception {
- Ignite ignite0 = ignite(gridCount() - 1);
-
- assertTrue(ignite0.configuration().isClientMode());
-
- Ignite ignite1 = ignite(0);
-
- assertFalse(ignite1.configuration().isClientMode());
-
- Affinity<Object> aff0 = ignite0.affinity(null);
- Affinity<Object> aff1 = ignite1.affinity(null);
-
- for (int i = 0 ; i < 100; i++) {
- TestObject1 obj1 = new TestObject1(i, i + 1);
-
- assertEquals(aff1.mapKeyToPrimaryAndBackups(obj1),
- aff0.mapKeyToPrimaryAndBackups(obj1));
-
- TestObject2 obj2 = new TestObject2(i, i + 1);
-
- assertEquals(aff1.mapKeyToPrimaryAndBackups(obj2),
- aff0.mapKeyToPrimaryAndBackups(obj2));
- }
-
- {
- PortableBuilder builder = ignite0.portables().builder("TestObject3");
-
- builder.setField("f1", 1);
-
- ignite0.cache(null).put(0, builder.build());
-
- IgniteCache<Integer, PortableObject> cache = ignite0.cache(null).withKeepPortable();
-
- PortableObject obj = cache.get(0);
-
- PortableMetadata meta = obj.metaData();
-
- assertNotNull(meta);
- assertEquals(1, meta.fields().size());
-
- meta = ignite0.portables().metadata(TestObject1.class);
-
- assertNotNull(meta);
- assertEquals("val2", meta.affinityKeyFieldName());
-
- meta = ignite0.portables().metadata(TestObject2.class);
-
- assertNotNull(meta);
- assertNull(meta.affinityKeyFieldName());
- }
-
- {
- PortableBuilder builder = ignite1.portables().builder("TestObject3");
-
- builder.setField("f2", 2);
-
- ignite1.cache(null).put(1, builder.build());
-
- IgniteCache<Integer, PortableObject> cache = ignite1.cache(null).withKeepPortable();
-
- PortableObject obj = cache.get(0);
-
- PortableMetadata meta = obj.metaData();
-
- assertNotNull(meta);
- assertEquals(2, meta.fields().size());
-
- meta = ignite1.portables().metadata(TestObject1.class);
-
- assertNotNull(meta);
- assertEquals("val2", meta.affinityKeyFieldName());
-
- meta = ignite1.portables().metadata(TestObject2.class);
-
- assertNotNull(meta);
- assertNull(meta.affinityKeyFieldName());
- }
-
- PortableMetadata meta = ignite0.portables().metadata("TestObject3");
-
- assertNotNull(meta);
- assertEquals(2, meta.fields().size());
-
- IgniteCache<Integer, PortableObject> cache = ignite0.cache(null).withKeepPortable();
-
- PortableObject obj = cache.get(1);
-
- assertEquals(Integer.valueOf(2), obj.field("f2"));
- assertNull(obj.field("f1"));
-
- meta = obj.metaData();
-
- assertNotNull(meta);
- assertEquals(2, meta.fields().size());
-
- Collection<PortableMetadata> meta1 = ignite1.portables().metadata();
- Collection<PortableMetadata> meta2 = ignite1.portables().metadata();
-
- assertEquals(meta1.size(), meta2.size());
-
- for (PortableMetadata m1 : meta1) {
- boolean found = false;
-
- for (PortableMetadata m2 : meta1) {
- if (m1.typeName().equals(m2.typeName())) {
- assertEquals(m1.affinityKeyFieldName(), m2.affinityKeyFieldName());
- assertEquals(m1.fields(), m2.fields());
-
- found = true;
-
- break;
- }
- }
-
- assertTrue(found);
- }
- }
-
- /**
- *
- */
- static class TestObject1 {
- /** */
- private int val1;
-
- /** */
- private int val2;
-
- /**
- * @param val1 Value 1.
- * @param val2 Value 2.
- */
- public TestObject1(int val1, int val2) {
- this.val1 = val1;
- this.val2 = val2;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- TestObject1 that = (TestObject1)o;
-
- return val1 == that.val1;
-
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return val1;
- }
- }
-
- /**
- *
- */
- static class TestObject2 {
- /** */
- private int val1;
-
- /** */
- private int val2;
-
- /**
- * @param val1 Value 1.
- * @param val2 Value 2.
- */
- public TestObject2(int val1, int val2) {
- this.val1 = val1;
- this.val2 = val2;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- TestObject2 that = (TestObject2)o;
-
- return val2 == that.val2;
-
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return val2;
- }
- }
-}
\ No newline at end of file
[48/50] [abbrv] ignite git commit: Fixed javadoc.
Posted by sb...@apache.org.
Fixed javadoc.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae1e1dc9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae1e1dc9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae1e1dc9
Branch: refs/heads/ignite-1093-2
Commit: ae1e1dc947a10335f79b087950a9c0f964092510
Parents: 3e762e2
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 16:34:22 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 16:34:22 2015 +0300
----------------------------------------------------------------------
.../internal/processors/cache/transactions/IgniteTxHandler.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae1e1dc9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 756672a..c2cc629 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -1049,7 +1049,7 @@ public class IgniteTxHandler {
*
* @param nodeId Node id that originated finish request.
* @param req Request.
- * @param {@code True} if transaction committed on this node.
+ * @param committed {@code True} if transaction committed on this node.
*/
protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committed) {
if (req.replyRequired()) {
[03/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java
deleted file mode 100644
index 27ac436..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java
+++ /dev/null
@@ -1,117 +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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.CacheLocalQueryMetricsSelfTest;
-import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsDistributedSelfTest;
-import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheLargeResultSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapTieredMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingQueryErrorTest;
-import org.apache.ignite.internal.processors.cache.IgniteCachePartitionedQueryMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheQueryEvictsMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheQueryMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheQueryOffheapMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicNearEnabledSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicP2PDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryLocalAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryPartitionedOnlySelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedAtomicSelfTest;
-import org.apache.ignite.internal.processors.query.h2.sql.BaseH2CompareQueryTest;
-import org.apache.ignite.internal.processors.query.h2.sql.GridQueryParsingTest;
-import org.apache.ignite.internal.processors.query.h2.sql.H2CompareBigQueryTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.spi.communication.tcp.GridOrderedMessageCancelSelfTest;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- * Cache query suite with portable marshaller.
- */
-public class IgnitePortableCacheQueryTestSuite extends TestSuite {
- /**
- * @return Suite.
- * @throws Exception In case of error.
- */
- public static TestSuite suite() throws Exception {
- GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, PortableMarshaller.class.getName());
-
- TestSuite suite = new TestSuite("Grid Cache Query Test Suite using PortableMarshaller");
-
- // Parsing
- suite.addTestSuite(GridQueryParsingTest.class);
-
- // Queries tests.
- suite.addTestSuite(GridCacheQueryIndexDisabledSelfTest.class);
- suite.addTestSuite(IgniteCachePartitionedQueryMultiThreadedSelfTest.class);
- suite.addTestSuite(IgniteCacheLargeResultSelfTest.class);
- suite.addTestSuite(IgniteCacheQueryMultiThreadedSelfTest.class);
- suite.addTestSuite(IgniteCacheQueryEvictsMultiThreadedSelfTest.class);
- suite.addTestSuite(IgniteCacheQueryOffheapMultiThreadedSelfTest.class);
-
- suite.addTestSuite(IgniteCacheOffheapTieredMultithreadedSelfTest.class);
- suite.addTestSuite(GridCacheReduceQueryMultithreadedSelfTest.class);
-
-
- // Fields queries.
- suite.addTestSuite(IgniteCacheFieldsQueryNoDataSelfTest.class);
-
- // Continuous queries.
- suite.addTestSuite(GridCacheContinuousQueryLocalAtomicSelfTest.class);
- suite.addTestSuite(GridCacheContinuousQueryReplicatedAtomicSelfTest.class);
- suite.addTestSuite(GridCacheContinuousQueryPartitionedOnlySelfTest.class);
- suite.addTestSuite(GridCacheContinuousQueryAtomicSelfTest.class);
- suite.addTestSuite(GridCacheContinuousQueryAtomicNearEnabledSelfTest.class);
- suite.addTestSuite(GridCacheContinuousQueryAtomicP2PDisabledSelfTest.class);
-
- suite.addTestSuite(GridCacheQueryIndexingDisabledSelfTest.class);
-
- //Should be adjusted. Not ready to be used with PortableMarshaller.
- //suite.addTestSuite(GridCachePortableSwapScanQuerySelfTest.class);
-
- suite.addTestSuite(GridOrderedMessageCancelSelfTest.class);
-
- // Ignite cache and H2 comparison.
- suite.addTestSuite(BaseH2CompareQueryTest.class);
- suite.addTestSuite(H2CompareBigQueryTest.class);
-
- // Metrics tests
- suite.addTestSuite(CacheLocalQueryMetricsSelfTest.class);
- suite.addTestSuite(CachePartitionedQueryMetricsDistributedSelfTest.class);
- suite.addTestSuite(CachePartitionedQueryMetricsLocalSelfTest.class);
- suite.addTestSuite(CacheReplicatedQueryMetricsDistributedSelfTest.class);
- suite.addTestSuite(CacheReplicatedQueryMetricsLocalSelfTest.class);
-
- //Unmarshallig query test.
- suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
-
- suite.addTestSuite(GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.class);
- suite.addTestSuite(GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.class);
-
- return suite;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 3895506..738f910 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableMetaDataImpl;
import org.apache.ignite.internal.portable.PortableRawReaderEx;
import org.apache.ignite.internal.portable.PortableRawWriterEx;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl;
@@ -70,7 +71,6 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T4;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.portable.PortableMetadata;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -373,7 +373,7 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeInt(metas.size());
- for (org.apache.ignite.portable.PortableMetadata m : metas)
+ for (PortableMetadata m : metas)
writeMetadata0(writer, cacheObjProc.typeId(m.typeName()), m);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
index 638b4b1..9e092c5 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
@@ -33,7 +33,7 @@ import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_SUBGRID;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
index d95a82b..ee8f9a3 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurat
import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.platform.cpp.PlatformCppConfiguration;
import java.util.Collections;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index 6e03dfe..21cd01a 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -36,10 +36,10 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
import java.util.ArrayList;
import java.util.Collections;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index 183676b..6164ef3 100644
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@ -69,16 +69,16 @@
<!-- Portable marshaller configuration -->
<property name="marshaller">
- <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
+ <bean class="org.apache.ignite.internal.portable.api.PortableMarshaller">
<property name="typeConfigurations">
<list>
- <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
+ <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
<property name="className" value="org.apache.ignite.platform.PlatformComputePortable"/>
</bean>
- <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
+ <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
<property name="className" value="org.apache.ignite.platform.PlatformComputeJavaPortable"/>
</bean>
- <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
+ <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
<property name="className" value="org.apache.ignite.platform.PlatformComputeEnum"/>
</bean>
</list>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
index 0e8b825..9b90209 100644
--- a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
@@ -24,9 +24,10 @@ import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.jetbrains.annotations.Nullable;
@@ -89,7 +90,8 @@ public class PlatformComputePortableArgTask extends ComputeTaskAdapter<Object, I
@Nullable @Override public Object execute() {
PortableObject arg0 = ((PortableObject)arg);
- PortableMetadata meta = ignite.portables().metadata(arg0.typeId());
+ PortableMetadata meta = ignite instanceof IgniteEx ?
+ ((IgniteEx)ignite).portables().metadata(arg0.typeId()) : null;
if (meta == null)
throw new IgniteException("Metadata doesn't exist.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
index 4320df5..42514e3 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
@@ -347,13 +347,6 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea
}
/** {@inheritDoc} */
- @Override public IgnitePortables portables() {
- assert g != null;
-
- return g.portables();
- }
-
- /** {@inheritDoc} */
@Override public void close() throws IgniteException {
g.close();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index f5a29cb..ba44c85 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -319,10 +319,6 @@
<packages>org.apache.ignite.marshaller*</packages>
</group>
<group>
- <title>Portable Objects API</title>
- <packages>org.apache.ignite.portable*</packages>
- </group>
- <group>
<title>Visor Plugins</title>
<packages>org.apache.ignite.visor.plugin</packages>
</group>
@@ -712,10 +708,6 @@
<exclude>dev-tools/.gradle/**/*</exclude>
<exclude>dev-tools/gradle/wrapper/**/*</exclude>
<exclude>dev-tools/gradlew</exclude>
- <exclude>src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom</exclude>
- <exclude>src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml</exclude>
- <exclude>src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom</exclude>
- <exclude>src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml</exclude>
<!--shmem-->
<exclude>ipc/shmem/**/Makefile.in</exclude><!--auto generated files-->
<exclude>ipc/shmem/**/Makefile</exclude><!--auto generated files-->
@@ -745,8 +737,6 @@
<exclude>src/main/java/META-INF/services/org.apache.ignite.internal.processors.platform.PlatformBootstrapFactory</exclude>
<exclude>src/main/resources/META-INF/services/org.apache.ignite.internal.processors.platform.PlatformBootstrapFactory</exclude>
<exclude>src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj</exclude>
- <exclude>src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar</exclude>
- <exclude>src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar</exclude>
<exclude>**/Makefile.am</exclude>
<exclude>**/configure.ac</exclude>
<exclude>**/*.pc.in</exclude>
[15/50] [abbrv] ignite git commit: Merge branch 'ignite-1.4' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.4-main
Posted by sb...@apache.org.
Merge branch 'ignite-1.4' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.4-main
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5f16818
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5f16818
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5f16818
Branch: refs/heads/ignite-1093-2
Commit: e5f16818c20c774c2dcccfacbd85040a071edce9
Parents: 71379a8 c01313d
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Sep 14 17:36:15 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Sep 14 17:36:15 2015 +0300
----------------------------------------------------------------------
.../processors/platform/services/PlatformAbstractService.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[47/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3e762e25
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3e762e25
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3e762e25
Branch: refs/heads/ignite-1093-2
Commit: 3e762e25e91f3223fcd2a78bcd80651784e4c32e
Parents: adf5ef6 6e19979
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 16:23:33 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 16:23:33 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 10 +-
.../dht/GridClientPartitionTopology.java | 104 +++++++++++--------
.../dht/GridDhtPartitionTopology.java | 4 +-
.../dht/GridDhtPartitionTopologyImpl.java | 7 +-
.../ignite/internal/util/IgniteUtils.java | 16 +++
5 files changed, 87 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
[26/50] [abbrv] ignite git commit: IGNITE-1392: Fixed.
Posted by sb...@apache.org.
IGNITE-1392: Fixed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2db59e68
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2db59e68
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2db59e68
Branch: refs/heads/ignite-1093-2
Commit: 2db59e68913ad05aaeb2bbb3351d84f773cd6f3e
Parents: f8b798d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 09:40:36 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 09:40:36 2015 +0300
----------------------------------------------------------------------
examples/config/filesystem/README.txt | 2 +-
examples/config/filesystem/example-igfs.xml | 7 -------
2 files changed, 1 insertion(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2db59e68/examples/config/filesystem/README.txt
----------------------------------------------------------------------
diff --git a/examples/config/filesystem/README.txt b/examples/config/filesystem/README.txt
index c01881c..4f6ae88 100644
--- a/examples/config/filesystem/README.txt
+++ b/examples/config/filesystem/README.txt
@@ -2,7 +2,7 @@ FileSystem Configuration Example
--------------------------------
This folder contains configuration files for IgniteFs examples located in
-org.apache.ignite.examples.fs package.
+org.apache.ignite.examples.igfs package.
- example-igfs.xml file is used to start Apache Ignite nodes with IgniteFS configured
- core-site.xml file is used to run Hadoop FS driver over IgniteFs
http://git-wip-us.apache.org/repos/asf/ignite/blob/2db59e68/examples/config/filesystem/example-igfs.xml
----------------------------------------------------------------------
diff --git a/examples/config/filesystem/example-igfs.xml b/examples/config/filesystem/example-igfs.xml
index 41ac865..0a0b1b4 100644
--- a/examples/config/filesystem/example-igfs.xml
+++ b/examples/config/filesystem/example-igfs.xml
@@ -76,13 +76,6 @@
<property name="prefetchBlocks" value="32"/>
<!--
- This will disable IPC endpoint binding thus preventing Hadoop clients from connecting to IgniteFs.
- With this option set to false the only possible way to interact with IgniteFs is through
- Ignite API.
- -->
- <property name="ipcEndpointEnabled" value="false"/>
-
- <!--
Example of configured IPC loopback endpoint.
-->
<!--
[29/50] [abbrv] ignite git commit: IGNITE-1477: Fixed.
Posted by sb...@apache.org.
IGNITE-1477: Fixed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c0e1ac18
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c0e1ac18
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c0e1ac18
Branch: refs/heads/ignite-1093-2
Commit: c0e1ac1842df19a4de83dbbcc99090b43371c913
Parents: c065512
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 10:25:09 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 10:25:09 2015 +0300
----------------------------------------------------------------------
.../hadoop/igfs/HadoopIgfsWrapper.java | 94 +++++++++++---------
1 file changed, 53 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c0e1ac18/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
index abbb142..01189f7 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsWrapper.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse;
import org.apache.ignite.internal.processors.igfs.IgfsStatus;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
@@ -339,7 +340,9 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
* @return Delegate.
*/
private Delegate delegate() throws HadoopIgfsCommunicationException {
- Exception err = null;
+ // These fields will contain possible exceptions from shmem and TCP endpoints.
+ Exception errShmem = null;
+ Exception errTcp = null;
// 1. If delegate is set, return it immediately.
Delegate curDelegate = delegateRef.get();
@@ -357,8 +360,8 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
igfs = (IgfsEx)ignite.fileSystem(endpoint.igfs());
}
- catch (Exception e) {
- err = e;
+ catch (Exception ignore) {
+ // No-op.
}
}
else {
@@ -368,8 +371,8 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
break;
}
- catch (Exception e) {
- err = e;
+ catch (Exception ignore) {
+ // No-op.
}
}
}
@@ -388,57 +391,54 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
hadoop.close(true);
if (log.isDebugEnabled())
- log.debug("Failed to connect to in-proc IGFS, fallback to IPC mode.", e);
-
- err = e;
+ log.debug("Failed to connect to in-process IGFS, fallback to IPC mode.", e);
}
}
}
// 3. Try connecting using shmem.
- if (!parameter(conf, PARAM_IGFS_ENDPOINT_NO_LOCAL_SHMEM, authority, false)) {
- if (curDelegate == null && !U.isWindows()) {
- HadoopIgfsEx hadoop = null;
+ boolean skipLocShmem = parameter(conf, PARAM_IGFS_ENDPOINT_NO_LOCAL_SHMEM, authority, false);
- try {
- hadoop = new HadoopIgfsOutProc(endpoint.port(), endpoint.grid(), endpoint.igfs(), log, userName);
+ if (curDelegate == null && !skipLocShmem && !U.isWindows()) {
+ HadoopIgfsEx hadoop = null;
- curDelegate = new Delegate(hadoop, hadoop.handshake(logDir));
- }
- catch (IOException | IgniteCheckedException e) {
- if (e instanceof HadoopIgfsCommunicationException)
- hadoop.close(true);
+ try {
+ hadoop = new HadoopIgfsOutProc(endpoint.port(), endpoint.grid(), endpoint.igfs(), log, userName);
- if (log.isDebugEnabled())
- log.debug("Failed to connect to out-proc local IGFS using shmem.", e);
+ curDelegate = new Delegate(hadoop, hadoop.handshake(logDir));
+ }
+ catch (IOException | IgniteCheckedException e) {
+ if (e instanceof HadoopIgfsCommunicationException)
+ hadoop.close(true);
- err = e;
- }
+ if (log.isDebugEnabled())
+ log.debug("Failed to connect to IGFS using shared memory [port=" + endpoint.port() + ']', e);
+
+ errShmem = e;
}
}
// 4. Try local TCP connection.
boolean skipLocTcp = parameter(conf, PARAM_IGFS_ENDPOINT_NO_LOCAL_TCP, authority, false);
- if (!skipLocTcp) {
- if (curDelegate == null) {
- HadoopIgfsEx hadoop = null;
+ if (curDelegate == null && !skipLocTcp) {
+ HadoopIgfsEx hadoop = null;
- try {
- hadoop = new HadoopIgfsOutProc(LOCALHOST, endpoint.port(), endpoint.grid(), endpoint.igfs(),
- log, userName);
+ try {
+ hadoop = new HadoopIgfsOutProc(LOCALHOST, endpoint.port(), endpoint.grid(), endpoint.igfs(),
+ log, userName);
- curDelegate = new Delegate(hadoop, hadoop.handshake(logDir));
- }
- catch (IOException | IgniteCheckedException e) {
- if (e instanceof HadoopIgfsCommunicationException)
- hadoop.close(true);
+ curDelegate = new Delegate(hadoop, hadoop.handshake(logDir));
+ }
+ catch (IOException | IgniteCheckedException e) {
+ if (e instanceof HadoopIgfsCommunicationException)
+ hadoop.close(true);
- if (log.isDebugEnabled())
- log.debug("Failed to connect to out-proc local IGFS using TCP.", e);
+ if (log.isDebugEnabled())
+ log.debug("Failed to connect to IGFS using TCP [host=" + endpoint.host() +
+ ", port=" + endpoint.port() + ']', e);
- err = e;
- }
+ errTcp = e;
}
}
@@ -457,9 +457,10 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
hadoop.close(true);
if (log.isDebugEnabled())
- log.debug("Failed to connect to out-proc remote IGFS using TCP.", e);
+ log.debug("Failed to connect to IGFS using TCP [host=" + endpoint.host() +
+ ", port=" + endpoint.port() + ']', e);
- err = e;
+ errTcp = e;
}
}
@@ -469,8 +470,19 @@ public class HadoopIgfsWrapper implements HadoopIgfs {
return curDelegate;
}
- else
- throw new HadoopIgfsCommunicationException("Failed to connect to IGFS: " + endpoint, err);
+ else {
+ SB errMsg = new SB("Failed to connect to IGFS [endpoint=" + authority + ", attempts=[");
+
+ if (errShmem != null)
+ errMsg.a("[type=SHMEM, port=" + endpoint.port() + ", err=" + errShmem + "], ");
+
+ errMsg.a("[type=TCP, host=" + endpoint.host() + ", port=" + endpoint.port() + ", err=" + errTcp + "]] ");
+
+ errMsg.a("(ensure that IGFS is running and have IPC endpoint enabled; ensure that " +
+ "ignite-shmem-1.0.0.jar is in Hadoop classpath if you use shared memory endpoint).");
+
+ throw new HadoopIgfsCommunicationException(errMsg.toString());
+ }
}
/**
[42/50] [abbrv] ignite git commit: IGNITE-1400 On node stop prevent
exchange worker hang on topology lock
Posted by sb...@apache.org.
IGNITE-1400 On node stop prevent exchange worker hang on topology lock
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a81cce72
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a81cce72
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a81cce72
Branch: refs/heads/ignite-1093-2
Commit: a81cce7214c966de0281ef82da0b1fe042842911
Parents: 367d805
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 15:46:16 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 15:49:42 2015 +0300
----------------------------------------------------------------------
.../dht/GridClientPartitionTopology.java | 104 +++++++++++--------
.../dht/GridDhtPartitionTopology.java | 4 +-
.../dht/GridDhtPartitionTopologyImpl.java | 7 +-
.../ignite/internal/util/IgniteUtils.java | 16 +++
4 files changed, 83 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a81cce72/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 21a7b3b..5e3cc0b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -30,6 +30,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
@@ -110,7 +111,14 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
log = cctx.logger(getClass());
- beforeExchange(exchFut);
+ lock.writeLock().lock();
+
+ try {
+ beforeExchange0(cctx.localNode(), exchFut);
+ }
+ finally {
+ lock.writeLock().unlock();
+ }
}
/**
@@ -154,8 +162,8 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
GridDhtPartitionsExchangeFuture exchFut,
long updSeq,
boolean stopping
- ) {
- lock.writeLock().lock();
+ ) throws IgniteInterruptedCheckedException {
+ U.writeLock(lock);
try {
assert exchId.topologyVersion().compareTo(topVer) > 0 : "Invalid topology version [topVer=" + topVer +
@@ -208,67 +216,75 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public void beforeExchange(GridDhtPartitionsExchangeFuture exchFut) {
+ @Override public void beforeExchange(GridDhtPartitionsExchangeFuture exchFut) throws IgniteCheckedException {
ClusterNode loc = cctx.localNode();
- lock.writeLock().lock();
+ U.writeLock(lock);
try {
if (stopping)
return;
- GridDhtPartitionExchangeId exchId = exchFut.exchangeId();
+ beforeExchange0(loc, exchFut);
+ }
+ finally {
+ lock.writeLock().unlock();
+ }
+ }
- assert topVer.equals(exchId.topologyVersion()) : "Invalid topology version [topVer=" +
- topVer + ", exchId=" + exchId + ']';
+ /**
+ * @param loc Local node.
+ * @param exchFut Exchange future.
+ */
+ private void beforeExchange0(ClusterNode loc, GridDhtPartitionsExchangeFuture exchFut) {
+ GridDhtPartitionExchangeId exchId = exchFut.exchangeId();
- if (!exchId.isJoined())
- removeNode(exchId.nodeId());
+ assert topVer.equals(exchId.topologyVersion()) : "Invalid topology version [topVer=" +
+ topVer + ", exchId=" + exchId + ']';
- // In case if node joins, get topology at the time of joining node.
- ClusterNode oldest = CU.oldestAliveCacheServerNode(cctx, topVer);
+ if (!exchId.isJoined())
+ removeNode(exchId.nodeId());
- assert oldest != null;
+ // In case if node joins, get topology at the time of joining node.
+ ClusterNode oldest = CU.oldestAliveCacheServerNode(cctx, topVer);
- if (log.isDebugEnabled())
- log.debug("Partition map beforeExchange [exchId=" + exchId + ", fullMap=" + fullMapString() + ']');
+ assert oldest != null;
- long updateSeq = this.updateSeq.incrementAndGet();
-
- // If this is the oldest node.
- if (oldest.id().equals(loc.id()) || exchFut.isCacheAdded(cacheId, exchId.topologyVersion())) {
- if (node2part == null) {
- node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq);
+ if (log.isDebugEnabled())
+ log.debug("Partition map beforeExchange [exchId=" + exchId + ", fullMap=" + fullMapString() + ']');
- if (log.isDebugEnabled())
- log.debug("Created brand new full topology map on oldest node [exchId=" +
- exchId + ", fullMap=" + fullMapString() + ']');
- }
- else if (!node2part.valid()) {
- node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false);
+ long updateSeq = this.updateSeq.incrementAndGet();
- if (log.isDebugEnabled())
- log.debug("Created new full topology map on oldest node [exchId=" + exchId + ", fullMap=" +
- node2part + ']');
- }
- else if (!node2part.nodeId().equals(loc.id())) {
- node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false);
+ // If this is the oldest node.
+ if (oldest.id().equals(loc.id()) || exchFut.isCacheAdded(cacheId, exchId.topologyVersion())) {
+ if (node2part == null) {
+ node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq);
- if (log.isDebugEnabled())
- log.debug("Copied old map into new map on oldest node (previous oldest node left) [exchId=" +
- exchId + ", fullMap=" + fullMapString() + ']');
- }
+ if (log.isDebugEnabled())
+ log.debug("Created brand new full topology map on oldest node [exchId=" +
+ exchId + ", fullMap=" + fullMapString() + ']');
}
+ else if (!node2part.valid()) {
+ node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false);
- consistencyCheck();
+ if (log.isDebugEnabled())
+ log.debug("Created new full topology map on oldest node [exchId=" + exchId + ", fullMap=" +
+ node2part + ']');
+ }
+ else if (!node2part.nodeId().equals(loc.id())) {
+ node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false);
- if (log.isDebugEnabled())
- log.debug("Partition map after beforeExchange [exchId=" + exchId + ", fullMap=" +
- fullMapString() + ']');
- }
- finally {
- lock.writeLock().unlock();
+ if (log.isDebugEnabled())
+ log.debug("Copied old map into new map on oldest node (previous oldest node left) [exchId=" +
+ exchId + ", fullMap=" + fullMapString() + ']');
+ }
}
+
+ consistencyCheck();
+
+ if (log.isDebugEnabled())
+ log.debug("Partition map after beforeExchange [exchId=" + exchId + ", fullMap=" +
+ fullMapString() + ']');
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a81cce72/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index d4ea3d6..d642314 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
@@ -50,13 +51,14 @@ public interface GridDhtPartitionTopology {
*
* @param exchId Exchange ID.
* @param exchFut Exchange future.
+ * @throws IgniteInterruptedCheckedException If interrupted.
*/
public void updateTopologyVersion(
GridDhtPartitionExchangeId exchId,
GridDhtPartitionsExchangeFuture exchFut,
long updateSeq,
boolean stopping
- );
+ ) throws IgniteInterruptedCheckedException;
/**
* Topology version.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a81cce72/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index fcb012f..a0c9c88 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -34,6 +34,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
@@ -205,8 +206,8 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
GridDhtPartitionsExchangeFuture exchFut,
long updSeq,
boolean stopping
- ) {
- lock.writeLock().lock();
+ ) throws IgniteInterruptedCheckedException {
+ U.writeLock(lock);
try {
assert exchId.topologyVersion().compareTo(topVer) > 0 : "Invalid topology version [topVer=" + topVer +
@@ -267,7 +268,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
int num = cctx.affinity().partitions();
- lock.writeLock().lock();
+ U.writeLock(lock);
try {
GridDhtPartitionExchangeId exchId = exchFut.exchangeId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a81cce72/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index ba918f6..e5090cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -119,6 +119,7 @@ import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReadWriteLock;
import java.util.jar.JarFile;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
@@ -9286,4 +9287,19 @@ public abstract class IgniteUtils {
return hasShmem;
}
+
+ /**
+ * @param lock Lock.
+ * @throws IgniteInterruptedCheckedException If interrupted.
+ */
+ public static void writeLock(ReadWriteLock lock) throws IgniteInterruptedCheckedException {
+ try {
+ lock.writeLock().lockInterruptibly();
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+
+ throw new IgniteInterruptedCheckedException(e);
+ }
+ }
}
\ No newline at end of file
[10/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
index f7f5f4e..ef7dc9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
@@ -23,7 +23,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.platform.PlatformProcessor;
import org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
/**
* Default store manager implementation.
@@ -82,6 +82,6 @@ public class CacheOsStoreManager extends GridCacheStoreManagerAdapter {
/** {@inheritDoc} */
@Override public boolean configuredConvertPortable() {
- return !(ctx.config().getMarshaller() instanceof PortableMarshaller && cfg.isKeepPortableInStore());
+ return true;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
index fac69fb..423b5e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
@@ -19,12 +19,12 @@ package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.processors.platform.PlatformConfiguration;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import java.util.ArrayList;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
index a9b6022..92028b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
@@ -18,12 +18,12 @@
package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import java.util.ArrayList;
import java.util.Collection;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
index d7f1ab1..a307860 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
@@ -18,12 +18,12 @@
package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
deleted file mode 100644
index bfc34cd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ /dev/null
@@ -1,358 +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.marshaller.portable;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.marshaller.AbstractMarshaller;
-import org.apache.ignite.marshaller.MarshallerContext;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableProtocolVersion;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
- * in the portable format.
- * <p>
- * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
- * <p>
- * <h1 class="header">Configuration</h1>
- * <h2 class="header">Mandatory</h2>
- * This marshaller has no mandatory configuration parameters.
- * <h2 class="header">Java Example</h2>
- * <pre name="code" class="java">
- * PortableMarshaller marshaller = new PortableMarshaller();
- *
- * IgniteConfiguration cfg = new IgniteConfiguration();
- *
- * // Override marshaller.
- * cfg.setMarshaller(marshaller);
- *
- * // Starts grid.
- * G.start(cfg);
- * </pre>
- * <h2 class="header">Spring Example</h2>
- * PortableMarshaller can be configured from Spring XML configuration file:
- * <pre name="code" class="xml">
- * <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true">
- * ...
- * <property name="marshaller">
- * <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
- * ...
- * </bean>
- * </property>
- * ...
- * </bean>
- * </pre>
- * <p>
- * <img src="http://ignite.apache.org/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- */
-public class PortableMarshaller extends AbstractMarshaller {
- /** Default portable protocol version. */
- public static final PortableProtocolVersion DFLT_PORTABLE_PROTO_VER = PortableProtocolVersion.VER_1_4_0;
-
- /** Class names. */
- private Collection<String> clsNames;
-
- /** ID mapper. */
- private PortableIdMapper idMapper;
-
- /** Serializer. */
- private PortableSerializer serializer;
-
- /** Types. */
- private Collection<PortableTypeConfiguration> typeCfgs;
-
- /** Use timestamp flag. */
- private boolean useTs = true;
-
- /** Whether to convert string to bytes using UTF-8 encoding. */
- private boolean convertString = true;
-
- /** Meta data enabled flag. */
- private boolean metaDataEnabled = true;
-
- /** Keep deserialized flag. */
- private boolean keepDeserialized = true;
-
- /** Protocol version. */
- private PortableProtocolVersion protoVer = DFLT_PORTABLE_PROTO_VER;
-
- /** */
- private GridPortableMarshaller impl;
-
- /**
- * Gets class names.
- *
- * @return Class names.
- */
- public Collection<String> getClassNames() {
- return clsNames;
- }
-
- /**
- * Sets class names of portable objects explicitly.
- *
- * @param clsNames Class names.
- */
- public void setClassNames(Collection<String> clsNames) {
- this.clsNames = new ArrayList<>(clsNames.size());
-
- for (String clsName : clsNames)
- this.clsNames.add(clsName.trim());
- }
-
- /**
- * Gets ID mapper.
- *
- * @return ID mapper.
- */
- public PortableIdMapper getIdMapper() {
- return idMapper;
- }
-
- /**
- * Sets ID mapper.
- *
- * @param idMapper ID mapper.
- */
- public void setIdMapper(PortableIdMapper idMapper) {
- this.idMapper = idMapper;
- }
-
- /**
- * Gets serializer.
- *
- * @return Serializer.
- */
- public PortableSerializer getSerializer() {
- return serializer;
- }
-
- /**
- * Sets serializer.
- *
- * @param serializer Serializer.
- */
- public void setSerializer(PortableSerializer serializer) {
- this.serializer = serializer;
- }
-
- /**
- * Gets types configuration.
- *
- * @return Types configuration.
- */
- public Collection<PortableTypeConfiguration> getTypeConfigurations() {
- return typeCfgs;
- }
-
- /**
- * Sets type configurations.
- *
- * @param typeCfgs Type configurations.
- */
- public void setTypeConfigurations(Collection<PortableTypeConfiguration> typeCfgs) {
- this.typeCfgs = typeCfgs;
- }
-
- /**
- * If {@code true} then date values converted to {@link Timestamp} on deserialization.
- * <p>
- * Default value is {@code true}.
- *
- * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public boolean isUseTimestamp() {
- return useTs;
- }
-
- /**
- * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public void setUseTimestamp(boolean useTs) {
- this.useTs = useTs;
- }
-
- /**
- * Gets strings must be converted to or from bytes using UTF-8 encoding.
- * <p>
- * Default value is {@code true}.
- *
- * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
- */
- public boolean isConvertStringToBytes() {
- return convertString;
- }
-
- /**
- * Sets strings must be converted to or from bytes using UTF-8 encoding.
- * <p>
- * Default value is {@code true}.
- *
- * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
- */
- public void setConvertStringToBytes(boolean convertString) {
- this.convertString = convertString;
- }
-
- /**
- * If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
- * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
- * <p>
- * Default value if {@code true}.
- *
- * @return Whether meta data is collected.
- */
- public boolean isMetaDataEnabled() {
- return metaDataEnabled;
- }
-
- /**
- * @param metaDataEnabled Whether meta data is collected.
- */
- public void setMetaDataEnabled(boolean metaDataEnabled) {
- this.metaDataEnabled = metaDataEnabled;
- }
-
- /**
- * If {@code true}, {@link PortableObject} will cache deserialized instance after
- * {@link PortableObject#deserialize()} is called. All consequent calls of this
- * method on the same instance of {@link PortableObject} will return that cached
- * value without actually deserializing portable object. If you need to override this
- * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
- * method.
- * <p>
- * Default value if {@code true}.
- *
- * @return Whether deserialized value is kept.
- */
- public boolean isKeepDeserialized() {
- return keepDeserialized;
- }
-
- /**
- * @param keepDeserialized Whether deserialized value is kept.
- */
- public void setKeepDeserialized(boolean keepDeserialized) {
- this.keepDeserialized = keepDeserialized;
- }
-
- /**
- * Gets portable protocol version.
- * <p>
- * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
- *
- * @return Portable protocol version.
- */
- public PortableProtocolVersion getProtocolVersion() {
- return protoVer;
- }
-
- /**
- * Sets portable protocol version.
- * <p>
- * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
- *
- * @param protoVer Portable protocol version.
- */
- public void setProtocolVersion(PortableProtocolVersion protoVer) {
- if (protoVer == null)
- throw new IllegalArgumentException("Wrong portable protocol version: " + protoVer);
-
- this.protoVer = protoVer;
- }
-
- /**
- * Returns currently set {@link MarshallerContext}.
- *
- * @return Marshaller context.
- */
- public MarshallerContext getContext() {
- return ctx;
- }
-
- /**
- * Sets {@link PortableContext}.
- * <p/>
- * @param ctx Portable context.
- */
- private void setPortableContext(PortableContext ctx) {
- ctx.configure(this);
-
- impl = new GridPortableMarshaller(ctx);
- }
-
- /** {@inheritDoc} */
- @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
- return impl.marshal(obj, 0);
- }
-
- /** {@inheritDoc} */
- @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
- byte[] arr = marshal(obj);
-
- try {
- out.write(arr);
- }
- catch (IOException e) {
- throw new PortableException("Failed to marshal the object: " + obj, e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
- return impl.deserialize(bytes, clsLdr);
- }
-
- /** {@inheritDoc} */
- @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-
- byte[] arr = new byte[4096];
- int cnt;
-
- // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that
- // returns number of bytes remaining.
- try {
- while ((cnt = in.read(arr)) != -1)
- buffer.write(arr, 0, cnt);
-
- buffer.flush();
-
- return impl.deserialize(buffer.toByteArray(), clsLdr);
- }
- catch (IOException e) {
- throw new PortableException("Failed to unmarshal the object from InputStream", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
deleted file mode 100644
index 90cc5e6..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains portable marshaller API classes.
- */
-package org.apache.ignite.marshaller.portable;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
deleted file mode 100644
index 377fcdc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
+++ /dev/null
@@ -1,137 +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.portable;
-
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
- * <p>
- * Here is an example of how a portable object can be built dynamically:
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
- *
- * builder.setField("fieldA", "A");
- * builder.setField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- * </pre>
- *
- * <p>
- * Also builder can be initialized by existing portable object. This allows changing some fields without affecting
- * other fields.
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder(person);
- *
- * builder.setField("name", "John");
- *
- * person = builder.build();
- * </pre>
- * </p>
- *
- * If you need to modify nested portable object you can get builder for nested object using
- * {@link #getField(String)}, changes made on nested builder will affect parent object,
- * for example:
- *
- * <pre name=code class=java>
- * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
- * PortableBuilder addressBuilder = personBuilder.setField("address");
- *
- * addressBuilder.setField("city", "New York");
- *
- * personPortableObj = personBuilder.build();
- *
- * // Should be "New York".
- * String city = personPortableObj.getField("address").getField("city");
- * </pre>
- *
- * @see IgnitePortables#builder(int)
- * @see IgnitePortables#builder(String)
- * @see IgnitePortables#builder(PortableObject)
- */
-public interface PortableBuilder {
- /**
- * Returns value assigned to the specified field.
- * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
- * which can be modified.
- * <p>
- * Collections and maps returned from this method are modifiable.
- *
- * @param name Field name.
- * @return Filed value.
- */
- public <T> T getField(String name);
-
- /**
- * Sets field value.
- *
- * @param name Field name.
- * @param val Field value (cannot be {@code null}).
- * @see PortableObject#metaData()
- */
- public PortableBuilder setField(String name, Object val);
-
- /**
- * Sets field value with value type specification.
- * <p>
- * Field type is needed for proper metadata update.
- *
- * @param name Field name.
- * @param val Field value.
- * @param type Field type.
- * @see PortableObject#metaData()
- */
- public <T> PortableBuilder setField(String name, @Nullable T val, Class<? super T> type);
-
- /**
- * Sets field value.
- * <p>
- * This method should be used if field is portable object.
- *
- * @param name Field name.
- * @param builder Builder for object field.
- */
- public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
-
- /**
- * Removes field from this builder.
- *
- * @param fieldName Field name.
- * @return {@code this} instance for chaining.
- */
- public PortableBuilder removeField(String fieldName);
-
- /**
- * Sets hash code for resulting portable object returned by {@link #build()} method.
- * <p>
- * If not set {@code 0} is used.
- *
- * @param hashCode Hash code.
- * @return {@code this} instance for chaining.
- */
- public PortableBuilder hashCode(int hashCode);
-
- /**
- * Builds portable object.
- *
- * @return Portable object.
- * @throws PortableException In case of error.
- */
- public PortableObject build() throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
deleted file mode 100644
index 0f8d78b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
+++ /dev/null
@@ -1,57 +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.portable;
-
-import org.apache.ignite.IgniteException;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating portable object serialization error.
- */
-public class PortableException extends IgniteException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates portable exception with error message.
- *
- * @param msg Error message.
- */
- public PortableException(String msg) {
- super(msg);
- }
-
- /**
- * Creates portable exception with {@link Throwable} as a cause.
- *
- * @param cause Cause.
- */
- public PortableException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates portable exception with error message and {@link Throwable} as a cause.
- *
- * @param msg Error message.
- * @param cause Cause.
- */
- public PortableException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
deleted file mode 100644
index 368e415..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
+++ /dev/null
@@ -1,56 +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.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Type and field ID mapper for portable objects. Ignite never writes full
- * strings for field or type names. Instead, for performance reasons, Ignite
- * writes integer hash codes for type and field names. It has been tested that
- * hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide {@code PortableIdMapper} allows to override the automatically
- * generated hash code IDs for the type and field names.
- * <p>
- * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
- * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
- */
-public interface PortableIdMapper {
- /**
- * Gets type ID for provided class name.
- * <p>
- * If {@code 0} is returned, hash code of class simple name will be used.
- *
- * @param clsName Class name.
- * @return Type ID.
- */
- public int typeId(String clsName);
-
- /**
- * Gets ID for provided field.
- * <p>
- * If {@code 0} is returned, hash code of field name will be used.
- *
- * @param typeId Type ID.
- * @param fieldName Field name.
- * @return Field ID.
- */
- public int fieldId(int typeId, String fieldName);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
deleted file mode 100644
index 0098ec3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
+++ /dev/null
@@ -1,58 +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.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating that class needed for deserialization of portable object does not exist.
- * <p>
- * Thrown from {@link PortableObject#deserialize()} method.
- */
-public class PortableInvalidClassException extends PortableException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates invalid class exception with error message.
- *
- * @param msg Error message.
- */
- public PortableInvalidClassException(String msg) {
- super(msg);
- }
-
- /**
- * Creates invalid class exception with {@link Throwable} as a cause.
- *
- * @param cause Cause.
- */
- public PortableInvalidClassException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates invalid class exception with error message and {@link Throwable} as a cause.
- *
- * @param msg Error message.
- * @param cause Cause.
- */
- public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
deleted file mode 100644
index 4270885..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
+++ /dev/null
@@ -1,48 +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.portable;
-
-/**
- * Interface that allows to implement custom serialization
- * logic for portable objects. Portable objects are not required
- * to implement this interface, in which case Ignite will automatically
- * serialize portable objects using reflection.
- * <p>
- * This interface, in a way, is analogous to {@link java.io.Externalizable}
- * interface, which allows users to override default serialization logic,
- * usually for performance reasons. The only difference here is that portable
- * serialization is already very fast and implementing custom serialization
- * logic for portables does not provide significant performance gains.
- */
-public interface PortableMarshalAware {
- /**
- * Writes fields to provided writer.
- *
- * @param writer Portable object writer.
- * @throws PortableException In case of error.
- */
- public void writePortable(PortableWriter writer) throws PortableException;
-
- /**
- * Reads fields from provided reader.
- *
- * @param reader Portable object reader.
- * @throws PortableException In case of error.
- */
- public void readPortable(PortableReader reader) throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
deleted file mode 100644
index 4ea808b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
+++ /dev/null
@@ -1,61 +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.portable;
-
-import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable type meta data. Metadata for portable types can be accessed from any of the
- * {@link IgnitePortables#metadata(String)} methods.
- * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableMetadata {
- /**
- * Gets portable type name.
- *
- * @return Portable type name.
- */
- public String typeName();
-
- /**
- * Gets collection of all field names for this portable type.
- *
- * @return Collection of all field names for this portable type.
- */
- public Collection<String> fields();
-
- /**
- * Gets name of the field type for a given field.
- *
- * @param fieldName Field name.
- * @return Field type name.
- */
- @Nullable public String fieldTypeName(String fieldName);
-
- /**
- * Portable objects can optionally specify custom key-affinity mapping in the
- * configuration. This method returns the name of the field which should be
- * used for the key-affinity mapping.
- *
- * @return Affinity key field name.
- */
- @Nullable public String affinityKeyFieldName();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
deleted file mode 100644
index 66b8f76..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
+++ /dev/null
@@ -1,154 +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.portable;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.TreeMap;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Wrapper for portable object in portable binary format. Once an object is defined as portable,
- * Ignite will always store it in memory in the portable (i.e. binary) format.
- * User can choose to work either with the portable format or with the deserialized form
- * (assuming that class definitions are present in the classpath).
- * <p>
- * <b>NOTE:</b> user does not need to (and should not) implement this interface directly.
- * <p>
- * To work with the portable format directly, user should create a cache projection
- * over {@code PortableObject} class and then retrieve individual fields as needed:
- * <pre name=code class=java>
- * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
- *
- * // Convert instance of MyKey to portable format.
- * // We could also use GridPortableBuilder to create the key in portable format directly.
- * PortableObject key = grid.portables().toPortable(new MyKey());
- *
- * PortableObject val = prj.get(key);
- *
- * String field = val.field("myFieldName");
- * </pre>
- * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
- * <pre name=code class=java>
- * IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null);
- *
- * MyValue val = cache.get(new MyKey());
- *
- * // Normal java getter.
- * String fieldVal = val.getMyFieldName();
- * </pre>
- * <h1 class="header">Working With Maps and Collections</h1>
- * All maps and collections in the portable objects are serialized automatically. When working
- * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
- * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
- * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
- * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
- * in C#, etc.
- * <h1 class="header">Dynamic Structure Changes</h1>
- * Since objects are always cached in the portable binary format, server does not need to
- * be aware of the class definitions. Moreover, if class definitions are not present or not
- * used on the server, then clients can continuously change the structure of the portable
- * objects without having to restart the cluster. For example, if one client stores a
- * certain class with fields A and B, and another client stores the same class with
- * fields B and C, then the server-side portable object will have the fields A, B, and C.
- * As the structure of a portable object changes, the new fields become available for SQL queries
- * automatically.
- * <h1 class="header">Building Portable Objects</h1>
- * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
- *
- * builder.setField("fieldA", "A");
- * builder.setField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- * </pre>
- * For the cases when class definition is present
- * in the class path, it is also possible to populate a standard POJO and then
- * convert it to portable format, like so:
- * <pre name=code class=java>
- * MyObject obj = new MyObject();
- *
- * obj.setFieldA("A");
- * obj.setFieldB(123);
- *
- * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
- * </pre>
- * <h1 class="header">Portable Metadata</h1>
- * Even though Ignite portable protocol only works with hash codes for type and field names
- * to achieve better performance, Ignite provides metadata for all portable types which
- * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
- * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableObject extends Serializable, Cloneable {
- /**
- * Gets portable object type ID.
- *
- * @return Type ID.
- */
- public int typeId();
-
- /**
- * Gets meta data for this portable object.
- *
- * @return Meta data.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metaData() throws PortableException;
-
- /**
- * Gets field value.
- *
- * @param fieldName Field name.
- * @return Field value.
- * @throws PortableException In case of any other error.
- */
- @Nullable public <F> F field(String fieldName) throws PortableException;
-
- /**
- * Checks whether field is set.
- *
- * @param fieldName Field name.
- * @return {@code true} if field is set.
- */
- public boolean hasField(String fieldName);
-
- /**
- * Gets fully deserialized instance of portable object.
- *
- * @return Fully deserialized instance of portable object.
- * @throws PortableInvalidClassException If class doesn't exist.
- * @throws PortableException In case of any other error.
- */
- @Nullable public <T> T deserialize() throws PortableException;
-
- /**
- * Copies this portable object.
- *
- * @return Copy of this portable object.
- */
- public PortableObject clone() throws CloneNotSupportedException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
deleted file mode 100644
index 9189b28..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
+++ /dev/null
@@ -1,41 +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.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable protocol version.
- */
-public enum PortableProtocolVersion {
- /** Ignite 1.4.0 release. */
- VER_1_4_0;
-
- /** Enumerated values. */
- private static final PortableProtocolVersion[] VALS = values();
-
- /**
- * Efficiently gets enumerated value from its ordinal.
- *
- * @param ord Ordinal value.
- * @return Enumerated value or {@code null} if ordinal out of range.
- */
- @Nullable public static PortableProtocolVersion fromOrdinal(int ord) {
- return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
deleted file mode 100644
index 3bae2e1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
+++ /dev/null
@@ -1,234 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Raw reader for portable objects. Raw reader does not use field name hash codes, therefore,
- * making the format even more compact. However, if the raw reader is used,
- * dynamic structure changes to the portable objects are not supported.
- */
-public interface PortableRawReader {
- /**
- * @return Byte value.
- * @throws PortableException In case of error.
- */
- public byte readByte() throws PortableException;
-
- /**
- * @return Short value.
- * @throws PortableException In case of error.
- */
- public short readShort() throws PortableException;
-
- /**
- * @return Integer value.
- * @throws PortableException In case of error.
- */
- public int readInt() throws PortableException;
-
- /**
- * @return Long value.
- * @throws PortableException In case of error.
- */
- public long readLong() throws PortableException;
-
- /**
- * @return Float value.
- * @throws PortableException In case of error.
- */
- public float readFloat() throws PortableException;
-
- /**
- * @return Double value.
- * @throws PortableException In case of error.
- */
- public double readDouble() throws PortableException;
-
- /**
- * @return Char value.
- * @throws PortableException In case of error.
- */
- public char readChar() throws PortableException;
-
- /**
- * @return Boolean value.
- * @throws PortableException In case of error.
- */
- public boolean readBoolean() throws PortableException;
-
- /**
- * @return Decimal value.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal readDecimal() throws PortableException;
-
- /**
- * @return String value.
- * @throws PortableException In case of error.
- */
- @Nullable public String readString() throws PortableException;
-
- /**
- * @return UUID.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID readUuid() throws PortableException;
-
- /**
- * @return Date.
- * @throws PortableException In case of error.
- */
- @Nullable public Date readDate() throws PortableException;
-
- /**
- * @return Timestamp.
- * @throws PortableException In case of error.
- */
- @Nullable public Timestamp readTimestamp() throws PortableException;
-
- /**
- * @return Object.
- * @throws PortableException In case of error.
- */
- @Nullable public <T> T readObject() throws PortableException;
-
- /**
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public byte[] readByteArray() throws PortableException;
-
- /**
- * @return Short array.
- * @throws PortableException In case of error.
- */
- @Nullable public short[] readShortArray() throws PortableException;
-
- /**
- * @return Integer array.
- * @throws PortableException In case of error.
- */
- @Nullable public int[] readIntArray() throws PortableException;
-
- /**
- * @return Long array.
- * @throws PortableException In case of error.
- */
- @Nullable public long[] readLongArray() throws PortableException;
-
- /**
- * @return Float array.
- * @throws PortableException In case of error.
- */
- @Nullable public float[] readFloatArray() throws PortableException;
-
- /**
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public double[] readDoubleArray() throws PortableException;
-
- /**
- * @return Char array.
- * @throws PortableException In case of error.
- */
- @Nullable public char[] readCharArray() throws PortableException;
-
- /**
- * @return Boolean array.
- * @throws PortableException In case of error.
- */
- @Nullable public boolean[] readBooleanArray() throws PortableException;
-
- /**
- * @return Decimal array.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
-
- /**
- * @return String array.
- * @throws PortableException In case of error.
- */
- @Nullable public String[] readStringArray() throws PortableException;
-
- /**
- * @return UUID array.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID[] readUuidArray() throws PortableException;
-
- /**
- * @return Date array.
- * @throws PortableException In case of error.
- */
- @Nullable public Date[] readDateArray() throws PortableException;
-
- /**
- * @return Object array.
- * @throws PortableException In case of error.
- */
- @Nullable public Object[] readObjectArray() throws PortableException;
-
- /**
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public <T> Collection<T> readCollection() throws PortableException;
-
- /**
- * @param colCls Collection class.
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public <T> Collection<T> readCollection(Class<? extends Collection<T>> colCls)
- throws PortableException;
-
- /**
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public <K, V> Map<K, V> readMap() throws PortableException;
-
- /**
- * @param mapCls Map class.
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public <K, V> Map<K, V> readMap(Class<? extends Map<K, V>> mapCls) throws PortableException;
-
- /**
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public <T extends Enum<?>> T readEnum() throws PortableException;
-
- /**
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public <T extends Enum<?>> T[] readEnumArray() throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
deleted file mode 100644
index 53f4f92..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
+++ /dev/null
@@ -1,219 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Raw writer for portable object. Raw writer does not write field name hash codes, therefore,
- * making the format even more compact. However, if the raw writer is used,
- * dynamic structure changes to the portable objects are not supported.
- */
-public interface PortableRawWriter {
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByte(byte val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShort(short val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeInt(int val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLong(long val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloat(float val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDouble(double val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeChar(char val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBoolean(boolean val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeString(@Nullable String val) throws PortableException;
-
- /**
- * @param val UUID to write.
- * @throws PortableException In case of error.
- */
- public void writeUuid(@Nullable UUID val) throws PortableException;
-
- /**
- * @param val Date to write.
- * @throws PortableException In case of error.
- */
- public void writeDate(@Nullable Date val) throws PortableException;
-
- /**
- * @param val Timestamp to write.
- * @throws PortableException In case of error.
- */
- public void writeTimestamp(@Nullable Timestamp val) throws PortableException;
-
- /**
- * @param obj Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObject(@Nullable Object obj) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByteArray(@Nullable byte[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShortArray(@Nullable short[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeIntArray(@Nullable int[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLongArray(@Nullable long[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloatArray(@Nullable float[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDoubleArray(@Nullable double[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeCharArray(@Nullable char[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBooleanArray(@Nullable boolean[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeStringArray(@Nullable String[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeUuidArray(@Nullable UUID[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDateArray(@Nullable Date[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObjectArray(@Nullable Object[] val) throws PortableException;
-
- /**
- * @param col Collection to write.
- * @throws PortableException In case of error.
- */
- public <T> void writeCollection(@Nullable Collection<T> col) throws PortableException;
-
- /**
- * @param map Map to write.
- * @throws PortableException In case of error.
- */
- public <K, V> void writeMap(@Nullable Map<K, V> map) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public <T extends Enum<?>> void writeEnum(T val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public <T extends Enum<?>> void writeEnumArray(T[] val) throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
deleted file mode 100644
index 58f078d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
+++ /dev/null
@@ -1,284 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Reader for portable objects used in {@link PortableMarshalAware} implementations.
- * Useful for the cases when user wants a fine-grained control over serialization.
- * <p>
- * Note that Ignite never writes full strings for field or type names. Instead,
- * for performance reasons, Ignite writes integer hash codes for type and field names.
- * It has been tested that hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide, Ignite provides {@link PortableIdMapper} which
- * allows to override the automatically generated hash code IDs for the type and field names.
- */
-public interface PortableReader {
- /**
- * @param fieldName Field name.
- * @return Byte value.
- * @throws PortableException In case of error.
- */
- public byte readByte(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Short value.
- * @throws PortableException In case of error.
- */
- public short readShort(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Integer value.
- * @throws PortableException In case of error.
- */
- public int readInt(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Long value.
- * @throws PortableException In case of error.
- */
- public long readLong(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @throws PortableException In case of error.
- * @return Float value.
- */
- public float readFloat(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Double value.
- * @throws PortableException In case of error.
- */
- public double readDouble(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Char value.
- * @throws PortableException In case of error.
- */
- public char readChar(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Boolean value.
- * @throws PortableException In case of error.
- */
- public boolean readBoolean(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Decimal value.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return String value.
- * @throws PortableException In case of error.
- */
- @Nullable public String readString(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return UUID.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID readUuid(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Date.
- * @throws PortableException In case of error.
- */
- @Nullable public Date readDate(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Timestamp.
- * @throws PortableException In case of error.
- */
- @Nullable public Timestamp readTimestamp(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Object.
- * @throws PortableException In case of error.
- */
- @Nullable public <T> T readObject(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public byte[] readByteArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Short array.
- * @throws PortableException In case of error.
- */
- @Nullable public short[] readShortArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Integer array.
- * @throws PortableException In case of error.
- */
- @Nullable public int[] readIntArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Long array.
- * @throws PortableException In case of error.
- */
- @Nullable public long[] readLongArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Float array.
- * @throws PortableException In case of error.
- */
- @Nullable public float[] readFloatArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public double[] readDoubleArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Char array.
- * @throws PortableException In case of error.
- */
- @Nullable public char[] readCharArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Boolean array.
- * @throws PortableException In case of error.
- */
- @Nullable public boolean[] readBooleanArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Decimal array.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return String array.
- * @throws PortableException In case of error.
- */
- @Nullable public String[] readStringArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return UUID array.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID[] readUuidArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Date array.
- * @throws PortableException In case of error.
- */
- @Nullable public Date[] readDateArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Object array.
- * @throws PortableException In case of error.
- */
- @Nullable public Object[] readObjectArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public <T> Collection<T> readCollection(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param colCls Collection class.
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public <T> Collection<T> readCollection(String fieldName, Class<? extends Collection<T>> colCls)
- throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public <K, V> Map<K, V> readMap(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param mapCls Map class.
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public <K, V> Map<K, V> readMap(String fieldName, Class<? extends Map<K, V>> mapCls)
- throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public <T extends Enum<?>> T readEnum(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public <T extends Enum<?>> T[] readEnumArray(String fieldName) throws PortableException;
-
- /**
- * Gets raw reader. Raw reader does not use field name hash codes, therefore,
- * making the format even more compact. However, if the raw reader is used,
- * dynamic structure changes to the portable objects are not supported.
- *
- * @return Raw reader.
- */
- public PortableRawReader rawReader();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
deleted file mode 100644
index 90ee562..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
+++ /dev/null
@@ -1,49 +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.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Interface that allows to implement custom serialization logic for portable objects.
- * Can be used instead of {@link PortableMarshalAware} in case if the class
- * cannot be changed directly.
- * <p>
- * Portable serializer can be configured for all portable objects via
- * {@link PortableMarshaller#getSerializer()} method, or for a specific
- * portable type via {@link PortableTypeConfiguration#getSerializer()} method.
- */
-public interface PortableSerializer {
- /**
- * Writes fields to provided writer.
- *
- * @param obj Empty object.
- * @param writer Portable object writer.
- * @throws PortableException In case of error.
- */
- public void writePortable(Object obj, PortableWriter writer) throws PortableException;
-
- /**
- * Reads fields from provided reader.
- *
- * @param obj Empty object
- * @param reader Portable object reader.
- * @throws PortableException In case of error.
- */
- public void readPortable(Object obj, PortableReader reader) throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
deleted file mode 100644
index 5e6e09d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
+++ /dev/null
@@ -1,196 +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.portable;
-
-import java.sql.Timestamp;
-import java.util.Collection;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Defines configuration properties for a specific portable type. Providing per-type
- * configuration is optional, as it is generally enough, and also optional, to provide global portable
- * configuration using {@link PortableMarshaller#setClassNames(Collection)}.
- * However, this class allows you to change configuration properties for a specific
- * portable type without affecting configuration for other portable types.
- * <p>
- * Per-type portable configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method.
- */
-public class PortableTypeConfiguration {
- /** Class name. */
- private String clsName;
-
- /** ID mapper. */
- private PortableIdMapper idMapper;
-
- /** Serializer. */
- private PortableSerializer serializer;
-
- /** Use timestamp flag. */
- private Boolean useTs;
-
- /** Meta data enabled flag. */
- private Boolean metaDataEnabled;
-
- /** Keep deserialized flag. */
- private Boolean keepDeserialized;
-
- /** Affinity key field name. */
- private String affKeyFieldName;
-
- /**
- */
- public PortableTypeConfiguration() {
- // No-op.
- }
-
- /**
- * @param clsName Class name.
- */
- public PortableTypeConfiguration(String clsName) {
- this.clsName = clsName;
- }
-
- /**
- * Gets type name.
- *
- * @return Type name.
- */
- public String getClassName() {
- return clsName;
- }
-
- /**
- * Sets type name.
- *
- * @param clsName Type name.
- */
- public void setClassName(String clsName) {
- this.clsName = clsName;
- }
-
- /**
- * Gets ID mapper.
- *
- * @return ID mapper.
- */
- public PortableIdMapper getIdMapper() {
- return idMapper;
- }
-
- /**
- * Sets ID mapper.
- *
- * @param idMapper ID mapper.
- */
- public void setIdMapper(PortableIdMapper idMapper) {
- this.idMapper = idMapper;
- }
-
- /**
- * Gets serializer.
- *
- * @return Serializer.
- */
- public PortableSerializer getSerializer() {
- return serializer;
- }
-
- /**
- * Sets serializer.
- *
- * @param serializer Serializer.
- */
- public void setSerializer(PortableSerializer serializer) {
- this.serializer = serializer;
- }
-
- /**
- * If {@code true} then date values converted to {@link Timestamp} during unmarshalling.
- *
- * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public Boolean isUseTimestamp() {
- return useTs;
- }
-
- /**
- * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public void setUseTimestamp(Boolean useTs) {
- this.useTs = useTs;
- }
-
- /**
- * Defines whether meta data is collected for this type. If provided, this value will override
- * {@link PortableMarshaller#isMetaDataEnabled()} property.
- *
- * @return Whether meta data is collected.
- */
- public Boolean isMetaDataEnabled() {
- return metaDataEnabled;
- }
-
- /**
- * @param metaDataEnabled Whether meta data is collected.
- */
- public void setMetaDataEnabled(Boolean metaDataEnabled) {
- this.metaDataEnabled = metaDataEnabled;
- }
-
- /**
- * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
- * this value will override {@link PortableMarshaller#isKeepDeserialized()}
- * property.
- *
- * @return Whether deserialized value is kept.
- */
- public Boolean isKeepDeserialized() {
- return keepDeserialized;
- }
-
- /**
- * @param keepDeserialized Whether deserialized value is kept.
- */
- public void setKeepDeserialized(Boolean keepDeserialized) {
- this.keepDeserialized = keepDeserialized;
- }
-
- /**
- * Gets affinity key field name.
- *
- * @return Affinity key field name.
- */
- public String getAffinityKeyFieldName() {
- return affKeyFieldName;
- }
-
- /**
- * Sets affinity key field name.
- *
- * @param affKeyFieldName Affinity key field name.
- */
- public void setAffinityKeyFieldName(String affKeyFieldName) {
- this.affKeyFieldName = affKeyFieldName;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PortableTypeConfiguration.class, this, super.toString());
- }
-}
\ No newline at end of file
[07/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/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
deleted file mode 100644
index 21fc81c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
+++ /dev/null
@@ -1,3807 +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.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 failed.
- */
- public void testShort() throws Exception {
- assertEquals((short)100, marshalUnmarshal((short)100).shortValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testInt() throws Exception {
- assertEquals(100, marshalUnmarshal(100).intValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLong() throws Exception {
- assertEquals(100L, marshalUnmarshal(100L).longValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFloat() throws Exception {
- assertEquals(100.001f, marshalUnmarshal(100.001f).floatValue(), 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDouble() throws Exception {
- assertEquals(100.001d, marshalUnmarshal(100.001d).doubleValue(), 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testChar() throws Exception {
- assertEquals((char)100, marshalUnmarshal((char)100).charValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testBoolean() throws Exception {
- assertEquals(true, marshalUnmarshal(true).booleanValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDecimal() throws Exception {
- BigDecimal val;
-
- assertEquals((val = BigDecimal.ZERO), marshalUnmarshal(val));
- assertEquals((val = BigDecimal.valueOf(Long.MAX_VALUE, 0)), marshalUnmarshal(val));
- assertEquals((val = BigDecimal.valueOf(Long.MIN_VALUE, 0)), marshalUnmarshal(val));
- assertEquals((val = BigDecimal.valueOf(Long.MAX_VALUE, 8)), marshalUnmarshal(val));
- assertEquals((val = BigDecimal.valueOf(Long.MIN_VALUE, 8)), marshalUnmarshal(val));
-
- assertEquals((val = new BigDecimal(new BigInteger("-79228162514264337593543950336"))), marshalUnmarshal(val));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testString() throws Exception {
- assertEquals("str", marshalUnmarshal("str"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUuid() throws Exception {
- UUID uuid = UUID.randomUUID();
-
- assertEquals(uuid, marshalUnmarshal(uuid));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDate() throws Exception {
- Date date = new Date();
-
- Date val = marshalUnmarshal(date);
-
- assertEquals(date, val);
- assertEquals(Timestamp.class, val.getClass()); // With default configuration should unmarshal as Timestamp.
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setUseTimestamp(false);
-
- val = marshalUnmarshal(date, marsh);
-
- assertEquals(date, val);
- assertEquals(Date.class, val.getClass());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTimestamp() throws Exception {
- Timestamp ts = new Timestamp(System.currentTimeMillis());
-
- ts.setNanos(999999999);
-
- assertEquals(ts, marshalUnmarshal(ts));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testByteArray() throws Exception {
- byte[] arr = new byte[] {10, 20, 30};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testShortArray() throws Exception {
- short[] arr = new short[] {10, 20, 30};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testIntArray() throws Exception {
- int[] arr = new int[] {10, 20, 30};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testLongArray() throws Exception {
- long[] arr = new long[] {10, 20, 30};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFloatArray() throws Exception {
- float[] arr = new float[] {10.1f, 20.1f, 30.1f};
-
- assertArrayEquals(arr, marshalUnmarshal(arr), 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDoubleArray() throws Exception {
- double[] arr = new double[] {10.1d, 20.1d, 30.1d};
-
- assertArrayEquals(arr, marshalUnmarshal(arr), 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCharArray() throws Exception {
- char[] arr = new char[] {10, 20, 30};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testBooleanArray() throws Exception {
- boolean[] arr = new boolean[] {true, false, true};
-
- assertBooleanArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDecimalArray() throws Exception {
- BigDecimal[] arr = new BigDecimal[] { BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN } ;
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testStringArray() throws Exception {
- String[] arr = new String[] {"str1", "str2", "str3"};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUuidArray() throws Exception {
- UUID[] arr = new UUID[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDateArray() throws Exception {
- Date[] arr = new Date[] {new Date(11111), new Date(22222), new Date(33333)};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testObjectArray() throws Exception {
- Object[] arr = new Object[] {1, 2, 3};
-
- assertArrayEquals(arr, marshalUnmarshal(arr));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCollection() throws Exception {
- testCollection(new ArrayList<Integer>(3));
- testCollection(new LinkedHashSet<Integer>());
- testCollection(new HashSet<Integer>());
- testCollection(new TreeSet<Integer>());
- testCollection(new ConcurrentSkipListSet<Integer>());
- }
-
- /**
- * @throws Exception If failed.
- */
- private void testCollection(Collection<Integer> col) throws Exception {
- col.add(1);
- col.add(2);
- col.add(3);
-
- assertEquals(col, marshalUnmarshal(col));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMap() throws Exception {
- testMap(new HashMap<Integer, String>());
- testMap(new LinkedHashMap());
- testMap(new TreeMap<Integer, String>());
- testMap(new ConcurrentHashMap8<Integer, String>());
- testMap(new ConcurrentHashMap<Integer, String>());
- }
-
- /**
- * @throws Exception If failed.
- */
- private void testMap(Map<Integer, String> map) throws Exception {
- map.put(1, "str1");
- map.put(2, "str2");
- map.put(3, "str3");
-
- assertEquals(map, marshalUnmarshal(map));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMapEntry() throws Exception {
- Map.Entry<Integer, String> e = new GridMapEntry<>(1, "str1");
-
- assertEquals(e, marshalUnmarshal(e));
-
- Map<Integer, String> map = new HashMap<>(1);
-
- map.put(2, "str2");
-
- e = F.firstEntry(map);
-
- Map.Entry<Integer, String> e0 = marshalUnmarshal(e);
-
- assertEquals(2, e0.getKey().intValue());
- assertEquals("str2", e0.getValue());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableObject() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(SimpleObject.class.getName())));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject po0 = marshalUnmarshal(po, marsh);
-
- assertTrue(po.hasField("b"));
- assertTrue(po.hasField("s"));
- assertTrue(po.hasField("i"));
- assertTrue(po.hasField("l"));
- assertTrue(po.hasField("f"));
- assertTrue(po.hasField("d"));
- assertTrue(po.hasField("c"));
- assertTrue(po.hasField("bool"));
-
- assertFalse(po.hasField("no_such_field"));
-
- assertEquals(obj, po.deserialize());
- assertEquals(obj, po0.deserialize());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testEnum() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestEnum.class.getName()));
-
- assertEquals(TestEnum.B, marshalUnmarshal(TestEnum.B, marsh));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUseTimestampFlag() throws Exception {
- PortableTypeConfiguration cfg1 = new PortableTypeConfiguration(DateClass1.class.getName());
-
- PortableTypeConfiguration cfg2 = new PortableTypeConfiguration(DateClass2.class.getName());
-
- cfg2.setUseTimestamp(false);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(cfg1, cfg2));
-
- Date date = new Date();
- Timestamp ts = new Timestamp(System.currentTimeMillis());
-
- DateClass1 obj1 = new DateClass1();
- obj1.date = date;
- obj1.ts = ts;
-
- DateClass2 obj2 = new DateClass2();
- obj2.date = date;
- obj2.ts = ts;
-
- PortableObject po1 = marshal(obj1, marsh);
-
- assertEquals(date, po1.field("date"));
- assertEquals(Timestamp.class, po1.field("date").getClass());
- assertEquals(ts, po1.field("ts"));
-
- PortableObject po2 = marshal(obj2, marsh);
-
- assertEquals(date, po2.field("date"));
- assertEquals(Date.class, po2.field("date").getClass());
- assertEquals(new Date(ts.getTime()), po2.field("ts"));
- assertEquals(Date.class, po2.field("ts").getClass());
-
- obj1 = po1.deserialize();
- assertEquals(date, obj1.date);
- assertEquals(Date.class, obj1.date.getClass());
- assertEquals(ts, obj1.ts);
-
- obj2 = po2.deserialize();
- assertEquals(date, obj2.date);
- assertEquals(Date.class, obj2.date.getClass());
- assertEquals(ts, obj2.ts);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSimpleObject() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- assertEquals(obj.hashCode(), po.hashCode());
-
- assertEquals(obj, po.deserialize());
-
- assertEquals(obj.b, (byte)po.field("b"));
- assertEquals(obj.s, (short)po.field("s"));
- assertEquals(obj.i, (int)po.field("i"));
- assertEquals(obj.l, (long)po.field("l"));
- assertEquals(obj.f, (float)po.field("f"), 0);
- assertEquals(obj.d, (double)po.field("d"), 0);
- assertEquals(obj.c, (char)po.field("c"));
- assertEquals(obj.bool, (boolean)po.field("bool"));
- assertEquals(obj.str, po.field("str"));
- assertEquals(obj.uuid, po.field("uuid"));
- assertEquals(obj.date, po.field("date"));
- assertEquals(Date.class, obj.date.getClass());
- assertEquals(obj.ts, po.field("ts"));
- assertArrayEquals(obj.bArr, (byte[])po.field("bArr"));
- assertArrayEquals(obj.sArr, (short[])po.field("sArr"));
- assertArrayEquals(obj.iArr, (int[])po.field("iArr"));
- assertArrayEquals(obj.lArr, (long[])po.field("lArr"));
- assertArrayEquals(obj.fArr, (float[])po.field("fArr"), 0);
- assertArrayEquals(obj.dArr, (double[])po.field("dArr"), 0);
- assertArrayEquals(obj.cArr, (char[])po.field("cArr"));
- assertBooleanArrayEquals(obj.boolArr, (boolean[])po.field("boolArr"));
- assertArrayEquals(obj.strArr, (String[])po.field("strArr"));
- assertArrayEquals(obj.uuidArr, (UUID[])po.field("uuidArr"));
- assertArrayEquals(obj.dateArr, (Date[])po.field("dateArr"));
- assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
- assertEquals(obj.col, po.field("col"));
- assertEquals(obj.map, po.field("map"));
- assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
- assertNull(po.field("unknown"));
-
- PortableObject innerPo = po.field("inner");
-
- assertEquals(obj.inner, innerPo.deserialize());
-
- assertEquals(obj.inner.b, (byte)innerPo.field("b"));
- assertEquals(obj.inner.s, (short)innerPo.field("s"));
- assertEquals(obj.inner.i, (int)innerPo.field("i"));
- assertEquals(obj.inner.l, (long)innerPo.field("l"));
- assertEquals(obj.inner.f, (float)innerPo.field("f"), 0);
- assertEquals(obj.inner.d, (double)innerPo.field("d"), 0);
- assertEquals(obj.inner.c, (char)innerPo.field("c"));
- assertEquals(obj.inner.bool, (boolean)innerPo.field("bool"));
- assertEquals(obj.inner.str, innerPo.field("str"));
- assertEquals(obj.inner.uuid, innerPo.field("uuid"));
- assertEquals(obj.inner.date, innerPo.field("date"));
- assertEquals(Date.class, obj.inner.date.getClass());
- assertEquals(obj.inner.ts, innerPo.field("ts"));
- assertArrayEquals(obj.inner.bArr, (byte[])innerPo.field("bArr"));
- assertArrayEquals(obj.inner.sArr, (short[])innerPo.field("sArr"));
- assertArrayEquals(obj.inner.iArr, (int[])innerPo.field("iArr"));
- assertArrayEquals(obj.inner.lArr, (long[])innerPo.field("lArr"));
- assertArrayEquals(obj.inner.fArr, (float[])innerPo.field("fArr"), 0);
- assertArrayEquals(obj.inner.dArr, (double[])innerPo.field("dArr"), 0);
- assertArrayEquals(obj.inner.cArr, (char[])innerPo.field("cArr"));
- assertBooleanArrayEquals(obj.inner.boolArr, (boolean[])innerPo.field("boolArr"));
- assertArrayEquals(obj.inner.strArr, (String[])innerPo.field("strArr"));
- assertArrayEquals(obj.inner.uuidArr, (UUID[])innerPo.field("uuidArr"));
- assertArrayEquals(obj.inner.dateArr, (Date[])innerPo.field("dateArr"));
- assertArrayEquals(obj.inner.objArr, (Object[])innerPo.field("objArr"));
- assertEquals(obj.inner.col, innerPo.field("col"));
- assertEquals(obj.inner.map, innerPo.field("map"));
- assertEquals(new Integer(obj.inner.enumVal.ordinal()),
- new Integer(((Enum<?>)innerPo.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.inner.enumArr), ordinals((Enum<?>[])innerPo.field("enumArr")));
- assertNull(innerPo.field("inner"));
- assertNull(innerPo.field("unknown"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortable() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName()),
- new PortableTypeConfiguration(TestPortableObject.class.getName())
- ));
-
- TestPortableObject obj = portableObject();
-
- PortableObject po = marshal(obj, marsh);
-
- assertEquals(obj.hashCode(), po.hashCode());
-
- assertEquals(obj, po.deserialize());
-
- assertEquals(obj.b, (byte)po.field("_b"));
- assertEquals(obj.s, (short)po.field("_s"));
- assertEquals(obj.i, (int)po.field("_i"));
- assertEquals(obj.l, (long)po.field("_l"));
- assertEquals(obj.f, (float)po.field("_f"), 0);
- assertEquals(obj.d, (double)po.field("_d"), 0);
- assertEquals(obj.c, (char)po.field("_c"));
- assertEquals(obj.bool, (boolean)po.field("_bool"));
- assertEquals(obj.str, po.field("_str"));
- assertEquals(obj.uuid, po.field("_uuid"));
- assertEquals(obj.date, po.field("_date"));
- assertEquals(obj.ts, po.field("_ts"));
- assertArrayEquals(obj.bArr, (byte[])po.field("_bArr"));
- assertArrayEquals(obj.sArr, (short[])po.field("_sArr"));
- assertArrayEquals(obj.iArr, (int[])po.field("_iArr"));
- assertArrayEquals(obj.lArr, (long[])po.field("_lArr"));
- assertArrayEquals(obj.fArr, (float[])po.field("_fArr"), 0);
- assertArrayEquals(obj.dArr, (double[])po.field("_dArr"), 0);
- assertArrayEquals(obj.cArr, (char[])po.field("_cArr"));
- assertBooleanArrayEquals(obj.boolArr, (boolean[])po.field("_boolArr"));
- assertArrayEquals(obj.strArr, (String[])po.field("_strArr"));
- assertArrayEquals(obj.uuidArr, (UUID[])po.field("_uuidArr"));
- assertArrayEquals(obj.dateArr, (Date[])po.field("_dateArr"));
- assertArrayEquals(obj.objArr, (Object[])po.field("_objArr"));
- assertEquals(obj.col, po.field("_col"));
- assertEquals(obj.map, po.field("_map"));
- assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("_enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("_enumArr")));
- assertNull(po.field("unknown"));
-
- PortableObject simplePo = po.field("_simple");
-
- assertEquals(obj.simple, simplePo.deserialize());
-
- assertEquals(obj.simple.b, (byte)simplePo.field("b"));
- assertEquals(obj.simple.s, (short)simplePo.field("s"));
- assertEquals(obj.simple.i, (int)simplePo.field("i"));
- assertEquals(obj.simple.l, (long)simplePo.field("l"));
- assertEquals(obj.simple.f, (float)simplePo.field("f"), 0);
- assertEquals(obj.simple.d, (double)simplePo.field("d"), 0);
- assertEquals(obj.simple.c, (char)simplePo.field("c"));
- assertEquals(obj.simple.bool, (boolean)simplePo.field("bool"));
- assertEquals(obj.simple.str, simplePo.field("str"));
- assertEquals(obj.simple.uuid, simplePo.field("uuid"));
- assertEquals(obj.simple.date, simplePo.field("date"));
- assertEquals(Date.class, obj.simple.date.getClass());
- assertEquals(obj.simple.ts, simplePo.field("ts"));
- assertArrayEquals(obj.simple.bArr, (byte[])simplePo.field("bArr"));
- assertArrayEquals(obj.simple.sArr, (short[])simplePo.field("sArr"));
- assertArrayEquals(obj.simple.iArr, (int[])simplePo.field("iArr"));
- assertArrayEquals(obj.simple.lArr, (long[])simplePo.field("lArr"));
- assertArrayEquals(obj.simple.fArr, (float[])simplePo.field("fArr"), 0);
- assertArrayEquals(obj.simple.dArr, (double[])simplePo.field("dArr"), 0);
- assertArrayEquals(obj.simple.cArr, (char[])simplePo.field("cArr"));
- assertBooleanArrayEquals(obj.simple.boolArr, (boolean[])simplePo.field("boolArr"));
- assertArrayEquals(obj.simple.strArr, (String[])simplePo.field("strArr"));
- assertArrayEquals(obj.simple.uuidArr, (UUID[])simplePo.field("uuidArr"));
- assertArrayEquals(obj.simple.dateArr, (Date[])simplePo.field("dateArr"));
- assertArrayEquals(obj.simple.objArr, (Object[])simplePo.field("objArr"));
- assertEquals(obj.simple.col, simplePo.field("col"));
- assertEquals(obj.simple.map, simplePo.field("map"));
- assertEquals(new Integer(obj.simple.enumVal.ordinal()),
- new Integer(((Enum<?>)simplePo.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.simple.enumArr), ordinals((Enum<?>[])simplePo.field("enumArr")));
- assertNull(simplePo.field("simple"));
- assertNull(simplePo.field("portable"));
- assertNull(simplePo.field("unknown"));
-
- PortableObject portablePo = po.field("_portable");
-
- assertEquals(obj.portable, portablePo.deserialize());
-
- assertEquals(obj.portable.b, (byte)portablePo.field("_b"));
- assertEquals(obj.portable.s, (short)portablePo.field("_s"));
- assertEquals(obj.portable.i, (int)portablePo.field("_i"));
- assertEquals(obj.portable.l, (long)portablePo.field("_l"));
- assertEquals(obj.portable.f, (float)portablePo.field("_f"), 0);
- assertEquals(obj.portable.d, (double)portablePo.field("_d"), 0);
- assertEquals(obj.portable.c, (char)portablePo.field("_c"));
- assertEquals(obj.portable.bool, (boolean)portablePo.field("_bool"));
- assertEquals(obj.portable.str, portablePo.field("_str"));
- assertEquals(obj.portable.uuid, portablePo.field("_uuid"));
- assertEquals(obj.portable.date, portablePo.field("_date"));
- assertEquals(obj.portable.ts, portablePo.field("_ts"));
- assertArrayEquals(obj.portable.bArr, (byte[])portablePo.field("_bArr"));
- assertArrayEquals(obj.portable.sArr, (short[])portablePo.field("_sArr"));
- assertArrayEquals(obj.portable.iArr, (int[])portablePo.field("_iArr"));
- assertArrayEquals(obj.portable.lArr, (long[])portablePo.field("_lArr"));
- assertArrayEquals(obj.portable.fArr, (float[])portablePo.field("_fArr"), 0);
- assertArrayEquals(obj.portable.dArr, (double[])portablePo.field("_dArr"), 0);
- assertArrayEquals(obj.portable.cArr, (char[])portablePo.field("_cArr"));
- assertBooleanArrayEquals(obj.portable.boolArr, (boolean[])portablePo.field("_boolArr"));
- assertArrayEquals(obj.portable.strArr, (String[])portablePo.field("_strArr"));
- assertArrayEquals(obj.portable.uuidArr, (UUID[])portablePo.field("_uuidArr"));
- assertArrayEquals(obj.portable.dateArr, (Date[])portablePo.field("_dateArr"));
- assertArrayEquals(obj.portable.objArr, (Object[])portablePo.field("_objArr"));
- assertEquals(obj.portable.col, portablePo.field("_col"));
- assertEquals(obj.portable.map, portablePo.field("_map"));
- assertEquals(new Integer(obj.portable.enumVal.ordinal()),
- new Integer(((Enum<?>)portablePo.field("_enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.portable.enumArr), ordinals((Enum<?>[])portablePo.field("_enumArr")));
- assertNull(portablePo.field("_simple"));
- assertNull(portablePo.field("_portable"));
- assertNull(portablePo.field("unknown"));
- }
-
- /**
- * @param obj Simple object.
- * @param po Portable object.
- */
- private void checkSimpleObjectData(SimpleObject obj, PortableObject po) {
- assertEquals(obj.b, (byte)po.field("b"));
- assertEquals(obj.s, (short)po.field("s"));
- assertEquals(obj.i, (int)po.field("i"));
- assertEquals(obj.l, (long)po.field("l"));
- assertEquals(obj.f, (float)po.field("f"), 0);
- assertEquals(obj.d, (double)po.field("d"), 0);
- assertEquals(obj.c, (char)po.field("c"));
- assertEquals(obj.bool, (boolean)po.field("bool"));
- assertEquals(obj.str, po.field("str"));
- assertEquals(obj.uuid, po.field("uuid"));
- assertEquals(obj.date, po.field("date"));
- assertEquals(Date.class, obj.date.getClass());
- assertEquals(obj.ts, po.field("ts"));
- assertArrayEquals(obj.bArr, (byte[])po.field("bArr"));
- assertArrayEquals(obj.sArr, (short[])po.field("sArr"));
- assertArrayEquals(obj.iArr, (int[])po.field("iArr"));
- assertArrayEquals(obj.lArr, (long[])po.field("lArr"));
- assertArrayEquals(obj.fArr, (float[])po.field("fArr"), 0);
- assertArrayEquals(obj.dArr, (double[])po.field("dArr"), 0);
- assertArrayEquals(obj.cArr, (char[])po.field("cArr"));
- assertBooleanArrayEquals(obj.boolArr, (boolean[])po.field("boolArr"));
- assertArrayEquals(obj.strArr, (String[])po.field("strArr"));
- assertArrayEquals(obj.uuidArr, (UUID[])po.field("uuidArr"));
- assertArrayEquals(obj.dateArr, (Date[])po.field("dateArr"));
- assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
- assertEquals(obj.col, po.field("col"));
- assertEquals(obj.map, po.field("map"));
- assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
- assertNull(po.field("unknown"));
-
- assertEquals(obj, po.deserialize());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testInvalidClass() throws Exception {
- byte[] arr = new byte[20];
-
- arr[0] = 103;
-
- U.intToBytes(Integer.reverseBytes(11111), arr, 2);
-
- final PortableObject po = new PortableObjectImpl(initPortableContext(new PortableMarshaller()), arr, 0);
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- po.deserialize();
-
- return null;
- }
- }, PortableInvalidClassException.class, "Unknown type ID: 11111"
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClassWithoutPublicConstructor() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(NoPublicConstructor.class.getName()),
- new PortableTypeConfiguration(NoPublicDefaultConstructor.class.getName()),
- new PortableTypeConfiguration(ProtectedConstructor.class.getName()))
- );
-
- initPortableContext(marsh);
-
- NoPublicConstructor npc = new NoPublicConstructor();
- PortableObject npc2 = marshal(npc, marsh);
-
- assertEquals("test", npc2.<NoPublicConstructor>deserialize().val);
-
- NoPublicDefaultConstructor npdc = new NoPublicDefaultConstructor(239);
- PortableObject npdc2 = marshal(npdc, marsh);
-
- assertEquals(239, npdc2.<NoPublicDefaultConstructor>deserialize().val);
-
- ProtectedConstructor pc = new ProtectedConstructor();
- PortableObject pc2 = marshal(pc, marsh);
-
- assertEquals(ProtectedConstructor.class, pc2.<ProtectedConstructor>deserialize().getClass());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCustomSerializer() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- PortableTypeConfiguration type =
- new PortableTypeConfiguration(CustomSerializedObject1.class.getName());
-
- type.setSerializer(new CustomSerializer1());
-
- marsh.setTypeConfigurations(Arrays.asList(type));
-
- CustomSerializedObject1 obj1 = new CustomSerializedObject1(10);
-
- PortableObject po1 = marshal(obj1, marsh);
-
- assertEquals(20, po1.<CustomSerializedObject1>deserialize().val);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCustomSerializerWithGlobal() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setSerializer(new CustomSerializer1());
-
- PortableTypeConfiguration type1 =
- new PortableTypeConfiguration(CustomSerializedObject1.class.getName());
- PortableTypeConfiguration type2 =
- new PortableTypeConfiguration(CustomSerializedObject2.class.getName());
-
- type2.setSerializer(new CustomSerializer2());
-
- marsh.setTypeConfigurations(Arrays.asList(type1, type2));
-
- CustomSerializedObject1 obj1 = new CustomSerializedObject1(10);
-
- PortableObject po1 = marshal(obj1, marsh);
-
- assertEquals(20, po1.<CustomSerializedObject1>deserialize().val);
-
- CustomSerializedObject2 obj2 = new CustomSerializedObject2(10);
-
- PortableObject po2 = marshal(obj2, marsh);
-
- assertEquals(30, po2.<CustomSerializedObject2>deserialize().val);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCustomIdMapper() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- PortableTypeConfiguration type =
- new PortableTypeConfiguration(CustomMappedObject1.class.getName());
-
- type.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 11111;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- assert typeId == 11111;
-
- if ("val1".equals(fieldName))
- return 22222;
- else if ("val2".equals(fieldName))
- return 33333;
-
- assert false : "Unknown field: " + fieldName;
-
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(type));
-
- CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str");
-
- PortableObject po1 = marshal(obj1, marsh);
-
- assertEquals(11111, po1.typeId());
- assertEquals(22222, intFromPortable(po1, 18));
- assertEquals(33333, intFromPortable(po1, 31));
-
- assertEquals(10, po1.<CustomMappedObject1>deserialize().val1);
- assertEquals("str", po1.<CustomMappedObject1>deserialize().val2);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCustomIdMapperWithGlobal() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 11111;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- assert typeId == 11111;
-
- if ("val1".equals(fieldName)) return 22222;
- else if ("val2".equals(fieldName)) return 33333;
-
- assert false : "Unknown field: " + fieldName;
-
- return 0;
- }
- });
-
- PortableTypeConfiguration type1 =
- new PortableTypeConfiguration(CustomMappedObject1.class.getName());
- PortableTypeConfiguration type2 =
- new PortableTypeConfiguration(CustomMappedObject2.class.getName());
-
- type2.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 44444;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- assert typeId == 44444;
-
- if ("val1".equals(fieldName)) return 55555;
- else if ("val2".equals(fieldName)) return 66666;
-
- assert false : "Unknown field: " + fieldName;
-
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(type1, type2));
-
- CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str1");
-
- PortableObject po1 = marshal(obj1, marsh);
-
- assertEquals(11111, po1.typeId());
- assertEquals(22222, intFromPortable(po1, 18));
- assertEquals(33333, intFromPortable(po1, 31));
-
- assertEquals(10, po1.<CustomMappedObject1>deserialize().val1);
- assertEquals("str1", po1.<CustomMappedObject1>deserialize().val2);
-
- CustomMappedObject2 obj2 = new CustomMappedObject2(20, "str2");
-
- PortableObject po2 = marshal(obj2, marsh);
-
- assertEquals(44444, po2.typeId());
- assertEquals(55555, intFromPortable(po2, 18));
- assertEquals(66666, intFromPortable(po2, 31));
-
- assertEquals(20, po2.<CustomMappedObject2>deserialize().val1);
- assertEquals("str2", po2.<CustomMappedObject2>deserialize().val2);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDynamicObject() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(DynamicObject.class.getName())
- ));
-
- PortableObject po1 = marshal(new DynamicObject(0, 10, 20, 30), marsh);
-
- assertEquals(new Integer(10), po1.field("val1"));
- assertEquals(null, po1.field("val2"));
- assertEquals(null, po1.field("val3"));
-
- DynamicObject do1 = po1.deserialize();
-
- assertEquals(10, do1.val1);
- assertEquals(0, do1.val2);
- assertEquals(0, do1.val3);
-
- PortableObject po2 = marshal(new DynamicObject(1, 10, 20, 30), marsh);
-
- assertEquals(new Integer(10), po2.field("val1"));
- assertEquals(new Integer(20), po2.field("val2"));
- assertEquals(null, po2.field("val3"));
-
- DynamicObject do2 = po2.deserialize();
-
- assertEquals(10, do2.val1);
- assertEquals(20, do2.val2);
- assertEquals(0, do2.val3);
-
- PortableObject po3 = marshal(new DynamicObject(2, 10, 20, 30), marsh);
-
- assertEquals(new Integer(10), po3.field("val1"));
- assertEquals(new Integer(20), po3.field("val2"));
- assertEquals(new Integer(30), po3.field("val3"));
-
- DynamicObject do3 = po3.deserialize();
-
- assertEquals(10, do3.val1);
- assertEquals(20, do3.val2);
- assertEquals(30, do3.val3);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCycleLink() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(CycleLinkObject.class.getName())
- ));
-
- CycleLinkObject obj = new CycleLinkObject();
-
- obj.self = obj;
-
- PortableObject po = marshal(obj, marsh);
-
- CycleLinkObject obj0 = po.deserialize();
-
- assert obj0.self == obj0;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDetached() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(DetachedTestObject.class.getName()),
- new PortableTypeConfiguration(DetachedInnerTestObject.class.getName())
- ));
-
- UUID id = UUID.randomUUID();
-
- DetachedTestObject obj = marshal(new DetachedTestObject(
- new DetachedInnerTestObject(null, id)), marsh).deserialize();
-
- assertEquals(id, obj.inner1.id);
- assertEquals(id, obj.inner4.id);
-
- assert obj.inner1 == obj.inner4;
-
- PortableObjectImpl innerPo = (PortableObjectImpl)obj.inner2;
-
- assert innerPo.detached();
-
- DetachedInnerTestObject inner = innerPo.deserialize();
-
- assertEquals(id, inner.id);
-
- PortableObjectImpl detachedPo = (PortableObjectImpl)innerPo.detach();
-
- assert detachedPo.detached();
-
- inner = detachedPo.deserialize();
-
- assertEquals(id, inner.id);
-
- innerPo = (PortableObjectImpl)obj.inner3;
-
- assert innerPo.detached();
-
- inner = innerPo.deserialize();
-
- assertEquals(id, inner.id);
- assertNotNull(inner.inner);
-
- detachedPo = (PortableObjectImpl)innerPo.detach();
-
- assert detachedPo.detached();
-
- inner = innerPo.deserialize();
-
- assertEquals(id, inner.id);
- assertNotNull(inner.inner);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCollectionFields() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(CollectionFieldsObject.class.getName()),
- new PortableTypeConfiguration(Key.class.getName()),
- new PortableTypeConfiguration(Value.class.getName())
- ));
-
- Object[] arr = new Object[] {new Value(1), new Value(2), new Value(3)};
- Collection<Value> col = Arrays.asList(new Value(4), new Value(5), new Value(6));
- Map<Key, Value> map = F.asMap(new Key(10), new Value(10), new Key(20), new Value(20), new Key(30), new Value(30));
-
- CollectionFieldsObject obj = new CollectionFieldsObject(arr, col, map);
-
- PortableObject po = marshal(obj, marsh);
-
- Object[] arr0 = po.field("arr");
-
- assertEquals(3, arr0.length);
-
- int i = 1;
-
- for (Object valPo : arr0)
- assertEquals(i++, ((PortableObject)valPo).<Value>deserialize().val);
-
- Collection<PortableObject> col0 = po.field("col");
-
- i = 4;
-
- for (PortableObject valPo : col0)
- assertEquals(i++, valPo.<Value>deserialize().val);
-
- Map<PortableObject, PortableObject> map0 = po.field("map");
-
- for (Map.Entry<PortableObject, PortableObject> e : map0.entrySet())
- assertEquals(e.getKey().<Key>deserialize().key, e.getValue().<Value>deserialize().val);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDefaultMapping() throws Exception {
- PortableMarshaller marsh1 = new PortableMarshaller();
-
- PortableTypeConfiguration customMappingType =
- new PortableTypeConfiguration(TestPortableObject.class.getName());
-
- customMappingType.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- String typeName;
-
- try {
- Method mtd = PortableContext.class.getDeclaredMethod("typeName", String.class);
-
- mtd.setAccessible(true);
-
- typeName = (String)mtd.invoke(null, clsName);
- }
- catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
- throw new RuntimeException(e);
- }
-
- return typeName.toLowerCase().hashCode();
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return fieldName.toLowerCase().hashCode();
- }
- });
-
- marsh1.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName()),
- customMappingType
- ));
-
- TestPortableObject obj = portableObject();
-
- PortableObjectImpl po = marshal(obj, marsh1);
-
- PortableMarshaller marsh2 = new PortableMarshaller();
-
- marsh2.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName()),
- new PortableTypeConfiguration(TestPortableObject.class.getName())
- ));
-
- PortableContext ctx = initPortableContext(marsh2);
-
- po.context(ctx);
-
- assertEquals(obj, po.deserialize());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testTypeNames() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- PortableTypeConfiguration customType1 = new PortableTypeConfiguration(Value.class.getName());
-
- customType1.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 300;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- PortableTypeConfiguration customType2 = new PortableTypeConfiguration("org.gridgain.NonExistentClass1");
-
- customType2.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 400;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- PortableTypeConfiguration customType3 = new PortableTypeConfiguration("NonExistentClass2");
-
- customType3.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 500;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- PortableTypeConfiguration customType4 = new PortableTypeConfiguration("NonExistentClass5");
-
- customType4.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 0;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(Key.class.getName()),
- new PortableTypeConfiguration("org.gridgain.NonExistentClass3"),
- new PortableTypeConfiguration("NonExistentClass4"),
- customType1,
- customType2,
- customType3,
- customType4
- ));
-
- PortableContext ctx = initPortableContext(marsh);
-
- assertEquals("notconfiguredclass".hashCode(), ctx.typeId("NotConfiguredClass"));
- assertEquals("key".hashCode(), ctx.typeId("Key"));
- assertEquals("nonexistentclass3".hashCode(), ctx.typeId("NonExistentClass3"));
- assertEquals("nonexistentclass4".hashCode(), ctx.typeId("NonExistentClass4"));
- assertEquals(300, ctx.typeId(getClass().getSimpleName() + "$Value"));
- assertEquals(400, ctx.typeId("NonExistentClass1"));
- assertEquals(500, ctx.typeId("NonExistentClass2"));
- assertEquals("nonexistentclass5".hashCode(), ctx.typeId("NonExistentClass5"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFieldIdMapping() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- PortableTypeConfiguration customType1 = new PortableTypeConfiguration(Value.class.getName());
-
- customType1.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 300;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- switch (fieldName) {
- case "val1":
- return 301;
-
- case "val2":
- return 302;
-
- default:
- return 0;
- }
- }
- });
-
- PortableTypeConfiguration customType2 = new PortableTypeConfiguration("NonExistentClass1");
-
- customType2.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 400;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- switch (fieldName) {
- case "val1":
- return 401;
-
- case "val2":
- return 402;
-
- default:
- return 0;
- }
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(Key.class.getName()),
- new PortableTypeConfiguration("NonExistentClass2"),
- customType1,
- customType2));
-
- PortableContext ctx = initPortableContext(marsh);
-
- assertEquals("val".hashCode(), ctx.fieldId("key".hashCode(), "val"));
- assertEquals("val".hashCode(), ctx.fieldId("nonexistentclass2".hashCode(), "val"));
- assertEquals("val".hashCode(), ctx.fieldId("notconfiguredclass".hashCode(), "val"));
- assertEquals(301, ctx.fieldId(300, "val1"));
- assertEquals(302, ctx.fieldId(300, "val2"));
- assertEquals("val3".hashCode(), ctx.fieldId(300, "val3"));
- assertEquals(401, ctx.fieldId(400, "val1"));
- assertEquals(402, ctx.fieldId(400, "val2"));
- assertEquals("val3".hashCode(), ctx.fieldId(400, "val3"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDuplicateTypeId() throws Exception {
- final PortableMarshaller marsh = new PortableMarshaller();
-
- PortableTypeConfiguration customType1 = new PortableTypeConfiguration("org.gridgain.Class1");
-
- customType1.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 100;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- PortableTypeConfiguration customType2 = new PortableTypeConfiguration("org.gridgain.Class2");
-
- customType2.setIdMapper(new PortableIdMapper() {
- @Override public int typeId(String clsName) {
- return 100;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- marsh.setTypeConfigurations(Arrays.asList(customType1, customType2));
-
- try {
- initPortableContext(marsh);
- }
- catch (IgniteCheckedException e) {
- assertEquals("Duplicate type ID [clsName=org.gridgain.Class1, id=100]",
- e.getCause().getCause().getMessage());
-
- return;
- }
-
- assert false;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopy() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- final PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, null);
-
- assertEquals(obj, copy.deserialize());
-
- copy = copy(po, new HashMap<String, Object>());
-
- assertEquals(obj, copy.deserialize());
-
- Map<String, Object> map = new HashMap<>(1, 1.0f);
-
- map.put("i", 3);
-
- copy = copy(po, map);
-
- assertEquals((byte)2, copy.<Byte>field("b").byteValue());
- assertEquals((short)2, copy.<Short>field("s").shortValue());
- assertEquals(3, copy.<Integer>field("i").intValue());
- assertEquals(2L, copy.<Long>field("l").longValue());
- assertEquals(2.2f, copy.<Float>field("f").floatValue(), 0);
- assertEquals(2.2d, copy.<Double>field("d").doubleValue(), 0);
- assertEquals((char)2, copy.<Character>field("c").charValue());
- assertEquals(false, copy.<Boolean>field("bool").booleanValue());
-
- SimpleObject obj0 = copy.deserialize();
-
- assertEquals((byte)2, obj0.b);
- assertEquals((short)2, obj0.s);
- assertEquals(3, obj0.i);
- assertEquals(2L, obj0.l);
- assertEquals(2.2f, obj0.f, 0);
- assertEquals(2.2d, obj0.d, 0);
- assertEquals((char)2, obj0.c);
- assertEquals(false, obj0.bool);
-
- map = new HashMap<>(3, 1.0f);
-
- map.put("b", (byte)3);
- map.put("l", 3L);
- map.put("bool", true);
-
- copy = copy(po, map);
-
- assertEquals((byte)3, copy.<Byte>field("b").byteValue());
- assertEquals((short)2, copy.<Short>field("s").shortValue());
- assertEquals(2, copy.<Integer>field("i").intValue());
- assertEquals(3L, copy.<Long>field("l").longValue());
- assertEquals(2.2f, copy.<Float>field("f").floatValue(), 0);
- assertEquals(2.2d, copy.<Double>field("d").doubleValue(), 0);
- assertEquals((char)2, copy.<Character>field("c").charValue());
- assertEquals(true, copy.<Boolean>field("bool").booleanValue());
-
- obj0 = copy.deserialize();
-
- assertEquals((byte)3, obj0.b);
- assertEquals((short)2, obj0.s);
- assertEquals(2, obj0.i);
- assertEquals(3L, obj0.l);
- assertEquals(2.2f, obj0.f, 0);
- assertEquals(2.2d, obj0.d, 0);
- assertEquals((char)2, obj0.c);
- assertEquals(true, obj0.bool);
-
- map = new HashMap<>(8, 1.0f);
-
- map.put("b", (byte)3);
- map.put("s", (short)3);
- map.put("i", 3);
- map.put("l", 3L);
- map.put("f", 3.3f);
- map.put("d", 3.3d);
- map.put("c", (char)3);
- map.put("bool", true);
-
- copy = copy(po, map);
-
- assertEquals((byte)3, copy.<Byte>field("b").byteValue());
- assertEquals((short)3, copy.<Short>field("s").shortValue());
- assertEquals(3, copy.<Integer>field("i").intValue());
- assertEquals(3L, copy.<Long>field("l").longValue());
- assertEquals(3.3f, copy.<Float>field("f").floatValue(), 0);
- assertEquals(3.3d, copy.<Double>field("d").doubleValue(), 0);
- assertEquals((char)3, copy.<Character>field("c").charValue());
- assertEquals(true, copy.<Boolean>field("bool").booleanValue());
-
- obj0 = copy.deserialize();
-
- assertEquals((byte)3, obj0.b);
- assertEquals((short)3, obj0.s);
- assertEquals(3, obj0.i);
- assertEquals(3L, obj0.l);
- assertEquals(3.3f, obj0.f, 0);
- assertEquals(3.3d, obj0.d, 0);
- assertEquals((char)3, obj0.c);
- assertEquals(true, obj0.bool);
-
-// GridTestUtils.assertThrows(
-// log,
-// new Callable<Object>() {
-// @Override public Object call() throws Exception {
-// po.copy(F.<String, Object>asMap("i", false));
-//
-// return null;
-// }
-// },
-// PortableException.class,
-// "Invalid value type for field: i"
-// );
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyString() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("str", "str3"));
-
- assertEquals("str3", copy.<String>field("str"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertEquals("str3", obj0.str);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyUuid() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- UUID uuid = UUID.randomUUID();
-
- PortableObject copy = copy(po, F.<String, Object>asMap("uuid", uuid));
-
- assertEquals(uuid, copy.<UUID>field("uuid"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertEquals(uuid, obj0.uuid);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyByteArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("bArr", new byte[]{1, 2, 3}));
-
- assertArrayEquals(new byte[] {1, 2, 3}, copy.<byte[]>field("bArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new byte[] {1, 2, 3}, obj0.bArr);
- }
-
- /**
- * @param po Portable object.
- * @param fields Fields.
- * @return Copy.
- */
- private PortableObject copy(PortableObject po, Map<String, Object> fields) {
- PortableBuilder builder = PortableBuilderImpl.wrap(po);
-
- if (fields != null) {
- for (Map.Entry<String, Object> e : fields.entrySet())
- builder.setField(e.getKey(), e.getValue());
- }
-
- return builder.build();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyShortArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("sArr", new short[]{1, 2, 3}));
-
- assertArrayEquals(new short[] {1, 2, 3}, copy.<short[]>field("sArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new short[] {1, 2, 3}, obj0.sArr);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyIntArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("iArr", new int[]{1, 2, 3}));
-
- assertArrayEquals(new int[] {1, 2, 3}, copy.<int[]>field("iArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new int[] {1, 2, 3}, obj0.iArr);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyLongArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("lArr", new long[]{1, 2, 3}));
-
- assertArrayEquals(new long[] {1, 2, 3}, copy.<long[]>field("lArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new long[] {1, 2, 3}, obj0.lArr);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyFloatArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("fArr", new float[]{1, 2, 3}));
-
- assertArrayEquals(new float[] {1, 2, 3}, copy.<float[]>field("fArr"), 0);
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new float[] {1, 2, 3}, obj0.fArr, 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyDoubleArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("dArr", new double[]{1, 2, 3}));
-
- assertArrayEquals(new double[] {1, 2, 3}, copy.<double[]>field("dArr"), 0);
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new double[] {1, 2, 3}, obj0.dArr, 0);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyCharArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("cArr", new char[]{1, 2, 3}));
-
- assertArrayEquals(new char[]{1, 2, 3}, copy.<char[]>field("cArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new char[]{1, 2, 3}, obj0.cArr);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyStringArray() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- PortableObject copy = copy(po, F.<String, Object>asMap("strArr", new String[]{"str1", "str2"}));
-
- assertArrayEquals(new String[]{"str1", "str2"}, copy.<String[]>field("strArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertArrayEquals(new String[]{"str1", "str2"}, obj0.strArr);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyObject() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- SimpleObject newObj = new SimpleObject();
-
- newObj.i = 12345;
- newObj.fArr = new float[] {5, 8, 0};
- newObj.str = "newStr";
-
- PortableObject copy = copy(po, F.<String, Object>asMap("inner", newObj));
-
- assertEquals(newObj, copy.<PortableObject>field("inner").deserialize());
-
- SimpleObject obj0 = copy.deserialize();
-
- assertEquals(newObj, obj0.inner);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyNonPrimitives() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())
- ));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- Map<String, Object> map = new HashMap<>(3, 1.0f);
-
- SimpleObject newObj = new SimpleObject();
-
- newObj.i = 12345;
- newObj.fArr = new float[] {5, 8, 0};
- newObj.str = "newStr";
-
- map.put("str", "str555");
- map.put("inner", newObj);
- map.put("bArr", new byte[]{6, 7, 9});
-
- PortableObject copy = copy(po, map);
-
- assertEquals("str555", copy.<String>field("str"));
- assertEquals(newObj, copy.<PortableObject>field("inner").deserialize());
- assertArrayEquals(new byte[]{6, 7, 9}, copy.<byte[]>field("bArr"));
-
- SimpleObject obj0 = copy.deserialize();
-
- assertEquals("str555", obj0.str);
- assertEquals(newObj, obj0.inner);
- assertArrayEquals(new byte[] {6, 7, 9}, obj0.bArr);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableCopyMixed() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(SimpleObject.class.getName())));
-
- SimpleObject obj = simpleObject();
-
- PortableObject po = marshal(obj, marsh);
-
- Map<String, Object> map = new HashMap<>(3, 1.0f);
-
- SimpleObject newObj = new SimpleObject();
-
- newObj.i = 12345;
- newObj.fArr = new float[] {5, 8, 0};
- newObj.str = "newStr";
-
- map.put("i", 1234);
- map.put("str", "str555");
- map.put("inner", newObj);
- map.put("s", (short)2323);
- map.put("bArr", new byte[]{6, 7, 9});
- map.put("b", (byte)111);
-
- PortableObject copy = copy(po, map);
-
- assertEquals(1234, copy.<Integer>field("i").intValue());
- assertEquals("str555", copy.<String>field("str"));
- assertEquals(newObj, copy.<PortableObject>field("inner").deserialize());
- assertEquals((short)2323, copy.<Short>field("s").shortValue());
- assertArrayEquals(new byte[] {6, 7, 9}, copy.<byte[]>field("bArr"));
- assertEquals((byte)111, copy.<Byte>field("b").byteValue());
-
- SimpleObject obj0 = copy.deserialize();
-
- assertEquals(1234, obj0.i);
- assertEquals("str555", obj0.str);
- assertEquals(newObj, obj0.inner);
- assertEquals((short)2323, obj0.s);
- assertArrayEquals(new byte[] {6, 7, 9}, obj0.bArr);
- assertEquals((byte)111, obj0.b);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testKeepDeserialized() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(SimpleObject.class.getName()));
- marsh.setKeepDeserialized(true);
-
- PortableObject po = marshal(simpleObject(), marsh);
-
- assert po.deserialize() == po.deserialize();
-
- marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(SimpleObject.class.getName()));
- marsh.setKeepDeserialized(false);
-
- po = marshal(simpleObject(), marsh);
-
- assert po.deserialize() != po.deserialize();
-
- marsh = new PortableMarshaller();
-
- marsh.setKeepDeserialized(true);
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())));
-
- po = marshal(simpleObject(), marsh);
-
- assert po.deserialize() == po.deserialize();
-
- marsh = new PortableMarshaller();
-
- marsh.setKeepDeserialized(false);
- marsh.setTypeConfigurations(Arrays.asList(
- new PortableTypeConfiguration(SimpleObject.class.getName())));
-
- po = marshal(simpleObject(), marsh);
-
- assert po.deserialize() != po.deserialize();
-
- marsh = new PortableMarshaller();
-
- marsh.setKeepDeserialized(true);
-
- PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(SimpleObject.class.getName());
-
- typeCfg.setKeepDeserialized(false);
-
- marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
- po = marshal(simpleObject(), marsh);
-
- assert po.deserialize() != po.deserialize();
-
- marsh = new PortableMarshaller();
-
- marsh.setKeepDeserialized(false);
-
- typeCfg = new PortableTypeConfiguration(SimpleObject.class.getName());
-
- typeCfg.setKeepDeserialized(true);
-
- marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
- po = marshal(simpleObject(), marsh);
-
- assert po.deserialize() == po.deserialize();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOffheapPortable() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(SimpleObject.class.getName())));
-
- PortableContext ctx = initPortableContext(marsh);
-
- SimpleObject simpleObj = simpleObject();
-
- PortableObjectImpl obj = marshal(simpleObj, marsh);
-
- long ptr = 0;
-
- long ptr1 = 0;
-
- long ptr2 = 0;
-
- try {
- ptr = copyOffheap(obj);
-
- PortableObjectOffheapImpl offheapObj = new PortableObjectOffheapImpl(ctx,
- ptr,
- 0,
- obj.array().length);
-
- assertTrue(offheapObj.equals(offheapObj));
- assertFalse(offheapObj.equals(null));
- assertFalse(offheapObj.equals("str"));
- assertTrue(offheapObj.equals(obj));
- assertTrue(obj.equals(offheapObj));
-
- ptr1 = copyOffheap(obj);
-
- PortableObjectOffheapImpl offheapObj1 = new PortableObjectOffheapImpl(ctx,
- ptr1,
- 0,
- obj.array().length);
-
- assertTrue(offheapObj.equals(offheapObj1));
- assertTrue(offheapObj1.equals(offheapObj));
-
- assertEquals(obj.typeId(), offheapObj.typeId());
- assertEquals(obj.hashCode(), offheapObj.hashCode());
-
- checkSimpleObjectData(simpleObj, offheapObj);
-
- PortableObjectOffheapImpl innerOffheapObj = offheapObj.field("inner");
-
- assertNotNull(innerOffheapObj);
-
- checkSimpleObjectData(simpleObj.inner, innerOffheapObj);
-
- obj = (PortableObjectImpl)offheapObj.heapCopy();
-
- assertEquals(obj.typeId(), offheapObj.typeId());
- assertEquals(obj.hashCode(), offheapObj.hashCode());
-
- checkSimpleObjectData(simpleObj, obj);
-
- PortableObjectImpl innerObj = obj.field("inner");
-
- assertNotNull(innerObj);
-
- checkSimpleObjectData(simpleObj.inner, innerObj);
-
- simpleObj.d = 0;
-
- obj = marshal(simpleObj, marsh);
-
- assertFalse(offheapObj.equals(obj));
- assertFalse(obj.equals(offheapObj));
-
- ptr2 = copyOffheap(obj);
-
- PortableObjectOffheapImpl offheapObj2 = new PortableObjectOffheapImpl(ctx,
- ptr2,
- 0,
- obj.array().length);
-
- assertFalse(offheapObj.equals(offheapObj2));
- assertFalse(offheapObj2.equals(offheapObj));
- }
- finally {
- UNSAFE.freeMemory(ptr);
-
- if (ptr1 > 0)
- UNSAFE.freeMemory(ptr1);
-
- if (ptr2 > 0)
- UNSAFE.freeMemory(ptr2);
- }
- }
-
- /**
- *
- */
- public void testReadResolve() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(
- Arrays.asList(MySingleton.class.getName(), SingletonMarker.class.getName()));
-
- PortableObjectImpl portableObj = marshal(MySingleton.INSTANCE, marsh);
-
- assertTrue(portableObj.array().length <= 1024); // Check that big string was not serialized.
-
- MySingleton singleton = portableObj.deserialize();
-
- assertSame(MySingleton.INSTANCE, singleton);
- }
-
- /**
- *
- */
- public void testReadResolveOnPortableAware() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Collections.singletonList(MyTestClass.class.getName()));
-
- PortableObjectImpl portableObj = marshal(new MyTestClass(), marsh);
-
- MyTestClass obj = portableObj.deserialize();
-
- assertEquals("readResolve", obj.s);
- }
-
- /**
- * @throws Exception If ecxeption thrown.
- */
- public void testDeclareReadResolveInParent() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(ChildPortable.class.getName()));
-
- PortableObjectImpl portableObj = marshal(new ChildPortable(), marsh);
-
- ChildPortable singleton = portableObj.deserialize();
-
- assertNotNull(singleton.s);
- }
-
- /**
- *
- */
- public void testDecimalFields() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- Collection<String> clsNames = new ArrayList<>();
-
- clsNames.add(DecimalReflective.class.getName());
- clsNames.add(DecimalMarshalAware.class.getName());
-
- marsh.setClassNames(clsNames);
-
- // 1. Test reflective stuff.
- DecimalReflective obj1 = new DecimalReflective();
-
- obj1.val = BigDecimal.ZERO;
- obj1.valArr = new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN };
-
- PortableObjectImpl portObj = marshal(obj1, marsh);
-
- assertEquals(obj1.val, portObj.field("val"));
- assertArrayEquals(obj1.valArr, portObj.<BigDecimal[]>field("valArr"));
-
- assertEquals(obj1.val, portObj.<DecimalReflective>deserialize().val);
- assertArrayEquals(obj1.valArr, portObj.<DecimalReflective>deserialize().valArr);
-
- // 2. Test marshal aware stuff.
- DecimalMarshalAware obj2 = new DecimalMarshalAware();
-
- obj2.val = BigDecimal.ZERO;
- obj2.valArr = new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN.negate() };
- obj2.rawVal = BigDecimal.TEN;
- obj2.rawValArr = new BigDecimal[] { BigDecimal.ZERO, BigDecimal.ONE };
-
- portObj = marshal(obj2, marsh);
-
- assertEquals(obj2.val, portObj.field("val"));
- assertArrayEquals(obj2.valArr, portObj.<BigDecimal[]>field("valArr"));
-
- assertEquals(obj2.val, portObj.<DecimalMarshalAware>deserialize().val);
- assertArrayEquals(obj2.valArr, portObj.<DecimalMarshalAware>deserialize().valArr);
- assertEquals(obj2.rawVal, portObj.<DecimalMarshalAware>deserialize().rawVal);
- assertArrayEquals(obj2.rawValArr, portObj.<DecimalMarshalAware>deserialize().rawValArr);
- }
-
- /**
- * @throws IgniteCheckedException If failed.
- */
- public void testFinalField() throws IgniteCheckedException {
- PortableMarshaller marsh = new PortableMarshaller();
-
- SimpleObjectWithFinal obj = new SimpleObjectWithFinal();
-
- SimpleObjectWithFinal po0 = marshalUnmarshal(obj, marsh);
-
- assertEquals(obj.time, po0.time);
- }
-
- /**
- * @throws IgniteCheckedException If failed.
- */
- public void testThreadLocalArrayReleased() throws IgniteCheckedException {
- // Checking the writer directly.
- assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
- try (PortableWriterExImpl writer = new PortableWriterExImpl(initPortableContext(new PortableMarshaller()), 0)) {
- assertEquals(true, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
- writer.writeString("Thread local test");
-
- writer.array();
-
- assertEquals(true, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
- }
-
- // Checking the portable marshaller.
- assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- initPortableContext(marsh);
-
- marsh.marshal(new SimpleObject());
-
- assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
- // Checking the builder.
- PortableBuilder builder = new PortableBuilderImpl(initPortableContext(new PortableMarshaller()),
- "org.gridgain.foo.bar.TestClass");
-
- builder.setField("a", "1");
-
- PortableObject portableObj = builder.build();
-
- assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDuplicateName() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- initPortableContext(marsh);
-
- Test1.Job job1 = new Test1().new Job();
- Test2.Job job2 = new Test2().new Job();
-
- marsh.marshal(job1);
-
- try {
- marsh.marshal(job2);
- } catch (PortableException e) {
- assertEquals(true, e.getMessage().contains("Failed to register class"));
- return;
- }
-
- assert false;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClassFieldsMarshalling() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- initPortableContext(marsh);
-
- ObjectWithClassFields obj = new ObjectWithClassFields();
- obj.cls1 = GridPortableMarshallerSelfTest.class;
-
- byte[] marshal = marsh.marshal(obj);
-
- ObjectWithClassFields obj2 = marsh.unmarshal(marshal, null);
-
- assertEquals(obj.cls1, obj2.cls1);
- assertNull(obj2.cls2);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMarshallingThroughJdk() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- initPortableContext(marsh);
-
- InetSocketAddress addr = new InetSocketAddress("192.168.0.2", 4545);
-
- byte[] arr = marsh.marshal(addr);
-
- InetSocketAddress addr2 = marsh.unmarshal(arr, null);
-
- assertEquals(addr.getHostString(), addr2.getHostString());
- assertEquals(addr.getPort(), addr2.getPort());
-
- TestAddress testAddr = new TestAddress();
- testAddr.addr = addr;
- testAddr.str1 = "Hello World";
-
- SimpleObject simpleObj = new SimpleObject();
- simpleObj.c = 'g';
- simpleObj.date = new Date();
-
- testAddr.obj = simpleObj;
-
- arr = marsh.marshal(testAddr);
-
- TestAddress testAddr2 = marsh.unmarshal(arr, null);
-
- assertEquals(testAddr.addr.getHostString(), testAddr2.addr.getHostString());
- assertEquals(testAddr.addr.getPort(), testAddr2.addr.getPort());
- assertEquals(testAddr.str1, testAddr2.str1);
- assertEquals(testAddr.obj.c, testAddr2.obj.c);
- assertEquals(testAddr.obj.date, testAddr2.obj.date);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPredefinedTypeIds() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- PortableContext pCtx = initPortableContext(marsh);
-
- Field field = pCtx.getClass().getDeclaredField("predefinedTypeNames");
-
- field.setAccessible(true);
-
- Map<String, Integer> map = (Map<String, Integer>)field.get(pCtx);
-
- assertTrue(map.size() > 0);
-
- for (Map.Entry<String, Integer> entry : map.entrySet()) {
- int id = entry.getValue();
-
- if (id == GridPortableMarshaller.UNREGISTERED_TYPE_ID)
- continue;
-
- PortableClassDescriptor desc = pCtx.descriptorForTypeId(false, entry.getValue(), null);
-
- assertEquals(desc.typeId(), pCtx.typeId(desc.describedClass().getName()));
- assertEquals(desc.typeId(), pCtx.typeId(pCtx.typeName(desc.describedClass().getName())));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testCyclicReferencesMarshalling() throws Exception {
- PortableMarshaller marsh = new PortableMarshaller();
-
- SimpleObject obj = simpleObject();
-
- obj.bArr = obj.inner.bArr;
- obj.cArr = obj.inner.cArr;
- obj.boolArr = obj.inner.boolArr;
- obj.sArr = obj.inner.sArr;
- obj.strArr = obj.inner.strArr;
- obj.iArr = obj.inner.iArr;
- obj.lArr = obj.inner.lArr;
- obj.fArr = obj.inner.fArr;
- obj.dArr = obj.inner.dArr;
- obj.dateArr = obj.inner.dateArr;
- obj.uuidArr = obj.inner.uuidArr;
- obj.objArr = obj.inner.objArr;
- obj.bdArr = obj.inner.bdArr;
- obj.map = obj.inner.map;
- obj.col = obj.inner.col;
- obj.mEntry = obj.inner.mEntry;
-
- SimpleObject res = (SimpleObject)marshalUnmarshal(obj, marsh);
-
- assertEquals(obj, res);
-
- assertTrue(res.bArr == res.inner.bArr);
- assertTrue(res.cArr == res.inner.cArr);
- assertTrue(res.boolArr == res.inner.boolArr);
- assertTrue(res.sArr == res.inner.sArr);
- assertTrue(res.strArr == res.inner.strArr);
- assertTrue(res.iArr == res.inner.iArr);
- assertTrue(res.lArr == res.inner.lArr);
- assertTrue(res.fArr == res.inner.fArr);
- assertTrue(res.dArr == res.inner.dArr);
- assertTrue(res.dateArr == res.inner.dateArr);
- assertTrue(res.uuidArr == res.inner.uuidArr);
- assertTrue(res.objArr == res.inner.objArr);
- assertTrue(res.bdArr == res.inner.bdArr);
- assertTrue(res.map == res.inner.map);
- assertTrue(res.col == res.inner.col);
- assertTrue(res.mEntry == res.inner.mEntry);
- }
-
- /**
- *
- */
- private static class ObjectWithClassFields {
- private Class<?> cls1;
-
- private Class<?> cls2;
- }
-
- /**
- *
- */
- private static class TestAddress {
- /** */
- private SimpleObject obj;
-
- /** */
- private InetSocketAddress addr;
-
- /** */
- private String str1;
- }
-
- /**
- *
- */
- private static class Test1 {
- /**
- *
- */
- private class Job {
-
- }
- }
-
- /**
- *
- */
- private static class Test2 {
- /**
- *
- */
- private class Job {
-
- }
- }
-
- /**
- * @param obj Object.
- * @return Offheap address.
- */
- private long copyOffheap(PortableObjectImpl obj) {
- byte[] arr = obj.array();
-
- long ptr = UNSAFE.allocateMemory(arr.length);
-
- UNSAFE.copyMemory(arr, BYTE_ARR_OFF, null, ptr, arr.length);
-
- return ptr;
- }
-
- /**
- * @param enumArr Enum array.
- * @return Ordinals.
- */
- private <T extends Enum<?>> Integer[] ordinals(T[] enumArr) {
- Integer[] ords = new Integer[enumArr.length];
-
- for (int i = 0; i < enumArr.length; i++)
- ords[i] = enumArr[i].ordinal();
-
- return ords;
- }
-
- /**
- * @param po Portable object.
- * @param off Offset.
- * @return Value.
- */
- private int intFromPortable(PortableObject po, int off) {
- byte[] arr = U.field(po, "arr");
-
- return Integer.reverseBytes(U.bytesToInt(arr, off));
- }
-
- /**
- * @param obj Original object.
- * @return Result object.
- */
- private <T> T marshalUnmarshal(T obj) throws IgniteCheckedException {
- return marshalUnmarshal(obj, new PortableMarshaller());
- }
-
- /**
- * @param obj Original object.
- * @param marsh Marshaller.
- * @return Result object.
- */
- private <T> T marshalUnmarshal(Object obj, PortableMarshaller marsh) throws IgniteCheckedException {
- initPortableContext(marsh);
-
- byte[] bytes = marsh.marshal(obj);
-
- return marsh.unmarshal(bytes, null);
- }
-
- /**
- * @param obj Object.
- * @param marsh Marshaller.
- * @return Portable object.
- */
- private <T> PortableObjectImpl marshal(T obj, PortableMarshaller marsh) throws IgniteCheckedException {
- initPortableContext(marsh);
-
- byte[] bytes = marsh.marshal(obj);
-
- return new PortableObjectImpl(U.<GridPortableMarshaller>field(marsh, "impl").context(),
- bytes, 0);
- }
-
- /**
- * @return Portable context.
- */
- protected PortableContext initPortableContext(PortableMarshaller marsh) throws IgniteCheckedException {
- PortableContext ctx = new PortableContext(META_HND, null);
-
- marsh.setContext(new MarshallerContextTestImpl(null));
-
- IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx);
-
- return ctx;
- }
-
- /**
- * @param exp Expected.
- * @param act Actual.
- */
- private void assertBooleanArrayEquals(boolean[] exp, boolean[] act) {
- assertEquals(exp.length, act.length);
-
- for (int i = 0; i < act.length; i++)
- assertEquals(exp[i], act[i]);
- }
-
- /**
- *
- */
- private static class SimpleObjectWithFinal {
- /** */
- private final long time = System.currentTimeMillis();
- }
-
- /**
- * @return Simple object.
- */
- private SimpleObject simpleObject() {
- SimpleObject inner = new SimpleObject();
-
- inner.b = 1;
- inner.s = 1;
- inner.i = 1;
- inner.l = 1;
- inner.f = 1.1f;
- inner.d = 1.1d;
- inner.c = 1;
- inner.bool = true;
- inner.str = "str1";
- inner.uuid = UUID.randomUUID();
- inner.date = new Date();
- inner.ts = new Timestamp(System.currentTimeMillis());
- inner.bArr = new byte[] {1, 2, 3};
- inner.sArr = new short[] {1, 2, 3};
- inner.iArr = new int[] {1, 2, 3};
- inner.lArr = new long[] {1, 2, 3};
- inner.fArr = new float[] {1.1f, 2.2f, 3.3f};
- inner.dArr = new double[] {1.1d, 2.2d, 3.3d};
- inner.cArr = new char[] {1, 2, 3};
- inner.boolArr = new boolean[] {true, false, true};
- inner.strArr = new String[] {"str1", "str2", "str3"};
- inner.uuidArr = new UUID[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
- inner.dateArr = new Date[] {new Date(11111), new Date(22222), new Date(33333)};
- inner.objArr = new Object[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
- inner.col = new ArrayList<>();
- inner.map = new HashMap<>();
- inner.enumVal = TestEnum.A;
- inner.enumArr = new TestEnum[] {TestEnum.A, TestEnum.B};
- inner.bdArr = new BigDecimal[] {new BigDecimal(1000), BigDecimal.ONE};
-
- inner.col.add("str1");
- inner.col.add("str2");
- inner.col.add("str3");
-
- inner.map.put(1, "str1");
- inner.map.put(2, "str2");
- inner.map.put(3, "str3");
-
- inner.mEntry = inner.map.entrySet().iterator().next();
-
- SimpleObject outer = new SimpleObject();
-
- outer.b = 2;
- outer.s = 2;
- outer.i = 2;
- outer.l = 2;
- outer.f = 2.2f;
- outer.d = 2.2d;
- outer.c = 2;
- outer.bool = false;
- outer.str = "str2";
- outer.uuid = UUID.randomUUID();
- outer.date = new Date();
- outer.ts = new Timestamp(System.currentTimeMillis());
- outer.bArr = new byte[] {10, 20, 30};
- outer.sArr = new short[] {10, 20, 30};
- outer.iArr = new int[] {10, 20, 30};
- outer.lArr = new long[] {10, 20, 30};
- outer.fArr = new float[] {10.01f, 20.02f, 30.03f};
- outer.dArr = new double[] {10.01d, 20.02d, 30.03d};
- outer.cArr = new char[] {10, 20, 30};
- outer.boolArr = new boolean[] {false, true, false};
- outer.strArr = new String[] {"str10", "str20", "str30"};
- outer.uuidArr = new UUID[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
- outer.dateArr = new Date[] {new Date(44444), new Date(55555), new Date(66666)};
- outer.objArr = new Object[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
- outer.col = new ArrayList<>();
- outer.map = new HashMap<>();
- outer.enumVal = TestEnum.B;
- outer.enumArr = new TestEnum[] {TestEnum.B, TestEnum.C};
- outer.inner = inner;
- outer.bdArr = new BigDecimal[] {new BigDecimal(5000), BigDecimal.TEN};
-
-
- outer.col.add("str4");
- outer.col.add("str5");
- outer.col.add("str6");
-
- outer.map.put(4, "str4");
- o
<TRUNCATED>
[46/50] [abbrv] ignite git commit: Quick fix to Hadoop IGFS tests NPE.
Posted by sb...@apache.org.
Quick fix to Hadoop IGFS tests NPE.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/adf5ef61
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/adf5ef61
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/adf5ef61
Branch: refs/heads/ignite-1093-2
Commit: adf5ef6100b58beb6fb00d85123f34cb5d9e084a
Parents: 2aa292c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 16:23:10 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 16:23:10 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/igfs/IgfsAbstractSelfTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/adf5ef61/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 957363f..076c269 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -2686,6 +2686,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
public static void clear(UniversalFileSystemAdapter uni) throws Exception {
IgfsEx igfsEx = uni.getAdapter(IgfsEx.class);
- clear(igfsEx);
+ if (igfsEx != null)
+ clear(igfsEx);
}
}
\ No newline at end of file
[49/50] [abbrv] ignite git commit: Merge branch 'ignite-1.4'
Posted by sb...@apache.org.
Merge branch 'ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e48c9c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e48c9c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e48c9c4
Branch: refs/heads/ignite-1093-2
Commit: 6e48c9c4f8dca18300aaf168f764b7524e58851c
Parents: 277b76d ae1e1dc
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 16:39:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 16:39:27 2015 +0300
----------------------------------------------------------------------
.../internal/processors/cache/transactions/IgniteTxHandler.java | 2 +-
.../ignite/internal/processors/igfs/IgfsAbstractSelfTest.java | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[44/50] [abbrv] ignite git commit: Fixed
RendezvousAffinityFunction.hashIdResolver compatibility.
Posted by sb...@apache.org.
Fixed RendezvousAffinityFunction.hashIdResolver compatibility.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e19979b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e19979b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e19979b
Branch: refs/heads/ignite-1093-2
Commit: 6e19979b329d266d3be2f4abe2bdbd8dd443d64d
Parents: c257e07
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 15:57:03 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 15:57:03 2015 +0300
----------------------------------------------------------------------
.../internal/processors/cache/GridCacheProcessor.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e19979b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 4317f70..4ae0baa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -232,16 +232,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (cfg.getCacheMode() == PARTITIONED) {
RendezvousAffinityFunction aff = new RendezvousAffinityFunction();
- if (internalCache)
- aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
+ aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
cfg.setAffinity(aff);
}
else if (cfg.getCacheMode() == REPLICATED) {
RendezvousAffinityFunction aff = new RendezvousAffinityFunction(false, 512);
- if (internalCache)
- aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
+ aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
cfg.setAffinity(aff);
@@ -251,11 +249,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cfg.setAffinity(new LocalAffinityFunction());
}
else {
- if (cfg.getCacheMode() == PARTITIONED) {
+ if (cfg.getCacheMode() != LOCAL) {
if (cfg.getAffinity() instanceof RendezvousAffinityFunction) {
RendezvousAffinityFunction aff = (RendezvousAffinityFunction)cfg.getAffinity();
- if (internalCache && aff.getHashIdResolver() == null)
+ if (aff.getHashIdResolver() == null)
aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
}
}
[28/50] [abbrv] ignite git commit: Merge branch 'ignite-1.4'
Posted by sb...@apache.org.
Merge branch 'ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4d2f2fd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4d2f2fd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4d2f2fd
Branch: refs/heads/ignite-1093-2
Commit: a4d2f2fd2bdc1cab67c0646422a54db8f71b1927
Parents: 7955c15 1914c02
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Sep 14 23:41:47 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Sep 14 23:41:47 2015 -0700
----------------------------------------------------------------------
.../continuous/GridContinuousProcessor.java | 22 +++++++-------------
.../hadoop/SecondaryFileSystemProvider.java | 4 ++--
2 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
[27/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c0655121
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c0655121
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c0655121
Branch: refs/heads/ignite-1093-2
Commit: c0655121696dd1668b6b8eb0bbf8369240e41c05
Parents: 2db59e6 1914c02
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 09:40:58 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 09:40:58 2015 +0300
----------------------------------------------------------------------
.../continuous/GridContinuousProcessor.java | 22 +++++++-------------
1 file changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
[32/50] [abbrv] ignite git commit: ignite-971 Fixed offheap to swap
eviction, added failover tests with swap/offheap,
added retries for tx 'check backup' rollback.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
new file mode 100644
index 0000000..318db9e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
@@ -0,0 +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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.GridCacheIncrementTransformTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheTopologySafeGetSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearRemoveFailureTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearRemoveFailureTest;
+import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopSelfTest;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import java.util.Set;
+
+/**
+ * Test suite.
+ */
+public class IgniteCacheFailoverTestSuite3 extends TestSuite {
+ /**
+ * @return Ignite Cache Failover test suite.
+ * @throws Exception Thrown in case of the failure.
+ */
+ public static TestSuite suite() throws Exception {
+ return suite(null);
+ }
+
+ /**
+ * @param ignoredTests Tests don't include in the execution.
+ * @return Test suite.
+ * @throws Exception Thrown in case of the failure.
+ */
+ public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
+ TestSuite suite = new TestSuite("Cache Failover Test Suite3");
+
+ suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
+ suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class);
+ suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
+
+ suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
+
+ return suite;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index 869f25c..34ef79b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -18,18 +18,13 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.GridCachePutAllFailoverSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPutAllFailoverSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCachePutAllRestartTest;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicNodeRestartTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledOptimisticTxNodeRestartTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedNodeRestartTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedOptimisticTxNodeRestartTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedNodeRestartSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheAtomicReplicatedNodeRestartSelfTest;
/**
- * In-Memory Data Grid stability test suite on changing topology.
+ * Cache stability test suite on changing topology.
*/
public class IgniteCacheRestartTestSuite extends TestSuite {
/**
@@ -44,13 +39,6 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
suite.addTestSuite(GridCachePartitionedNearDisabledOptimisticTxNodeRestartTest.class);
- suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
- suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicPutAllFailoverSelfTest.class);
- suite.addTestSuite(IgniteCachePutAllRestartTest.class);
- suite.addTestSuite(GridCachePutAllFailoverSelfTest.class);
-
return suite;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
new file mode 100644
index 0000000..c9e9467
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
@@ -0,0 +1,47 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.GridCachePutAllFailoverSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPutAllFailoverSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteCachePutAllRestartTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicNodeRestartTest;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheAtomicReplicatedNodeRestartSelfTest;
+
+/**
+ * Cache stability test suite on changing topology.
+ */
+public class IgniteCacheRestartTestSuite2 extends TestSuite {
+ /**
+ * @return Suite.
+ * @throws Exception If failed.
+ */
+ public static TestSuite suite() throws Exception {
+ TestSuite suite = new TestSuite("Cache Restart Test Suite2");
+
+ suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
+ suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class);
+
+ suite.addTestSuite(IgniteCacheAtomicPutAllFailoverSelfTest.class);
+ suite.addTestSuite(IgniteCachePutAllRestartTest.class);
+ suite.addTestSuite(GridCachePutAllFailoverSelfTest.class);
+
+ return suite;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index 63e2bc3..07c49a5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -182,9 +182,11 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
/** {@inheritDoc} */
@Override public Value getValue(int col) {
if (col < DEFAULT_COLUMNS_COUNT) {
- Value v = peekValue(col);
+ Value v;
if (col == VAL_COL) {
+ v = syncValue(0);
+
long start = 0;
int attempt = 0;
@@ -206,11 +208,15 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
Object valObj = desc.readFromSwap(k);
if (valObj != null) {
- Value upd = desc.wrap(valObj, desc.valueType());
+ // Even if we've found valObj in swap, it is may be some new value,
+ // while the needed value was already unswapped, so we have to recheck it.
+ if ((v = WeakValue.unwrap(syncValue(0))) == null && (v = getOffheapValue(VAL_COL)) == null) {
+ Value upd = desc.wrap(valObj, desc.valueType());
- v = updateWeakValue(upd);
+ v = updateWeakValue(upd);
- return v == null ? upd : v;
+ return v == null ? upd : v;
+ }
}
else {
// If nothing found in swap then we should be already unswapped.
@@ -230,18 +236,21 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
". This can happen due to a long GC pause.");
}
}
-
- if (v == null) {
+ else {
assert col == KEY_COL : col;
- v = getOffheapValue(KEY_COL);
+ v = peekValue(KEY_COL);
- assert v != null : v;
+ if (v == null) {
+ v = getOffheapValue(KEY_COL);
- setValue(KEY_COL, v);
+ assert v != null;
- if (peekValue(VAL_COL) == null)
- cache();
+ setValue(KEY_COL, v);
+
+ if (peekValue(VAL_COL) == null)
+ cache();
+ }
}
assert !(v instanceof WeakValue) : v;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
index 8f453a5..eb0880a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
@@ -249,6 +249,10 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest {
assertEquals(ENTRY_CNT - i - 1, cache.localSize(CachePeekMode.ONHEAP));
}
+ log.info("Cache size [onheap=" + cache.localSize(CachePeekMode.ONHEAP) +
+ ", offheap=" + cache.localSize(CachePeekMode.OFFHEAP) +
+ ", swap=" + cache.localSize(CachePeekMode.SWAP) + ']');
+
// Ensure that part of entries located in off-heap memory and part is swapped.
assertEquals(0, cache.localSize(CachePeekMode.ONHEAP));
assertTrue(cache.localSize(CachePeekMode.OFFHEAP) > 0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index b02b37e..be644e2 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -32,7 +32,6 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlQuery;
@@ -55,6 +54,7 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Multi-threaded tests for cache queries.
@@ -111,7 +111,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
- cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setSwapEnabled(true);
cacheCfg.setBackups(1);
@@ -139,6 +139,11 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
return cacheCfg;
}
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return DURATION + 60_000;
+ }
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
index 909fd74..d7d2b5a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
@@ -22,11 +22,6 @@ package org.apache.ignite.internal.processors.cache;
*/
public class IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest extends IgniteCacheQueryOffheapMultiThreadedSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- fail("IGNITE-959");
- }
-
- /** {@inheritDoc} */
@Override protected boolean evictsEnabled() {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
index 7e72292..5dbb12c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
@@ -315,7 +315,7 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
info("Executed queries: " + c);
}
}
- }, qryThreadNum);
+ }, qryThreadNum, "query-thread");
final AtomicInteger restartCnt = new AtomicInteger();
@@ -334,10 +334,14 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
}
while (!locks.compareAndSet(g, 0, -1));
+ log.info("Stop node: " + g);
+
stopGrid(g);
Thread.sleep(rnd.nextInt(nodeLifeTime));
+ log.info("Start node: " + g);
+
startGrid(g);
Thread.sleep(rnd.nextInt(nodeLifeTime));
@@ -352,7 +356,7 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
return true;
}
- }, restartThreadsNum);
+ }, restartThreadsNum, "restart-thread");
Thread.sleep(duration);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
index 32da55a..45a249d 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
@@ -149,7 +149,7 @@ public class IgniteCacheQueryNodeRestartSelfTest extends GridCacheAbstractSelfTe
info("Executed queries: " + c);
}
}
- }, qryThreadNum);
+ }, qryThreadNum, "query-thread");
final AtomicInteger restartCnt = new AtomicInteger();
@@ -178,7 +178,7 @@ public class IgniteCacheQueryNodeRestartSelfTest extends GridCacheAbstractSelfTe
return true;
}
- }, 1);
+ }, 1, "restart-thread");
Thread.sleep(duration);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 9e903d1..1276405 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -277,7 +277,7 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
info("Executed queries: " + c);
}
}
- }, qryThreadNum);
+ }, qryThreadNum, "query-thread");
final AtomicInteger restartCnt = new AtomicInteger();
@@ -296,10 +296,14 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
}
while (!locks.compareAndSet(g, 0, -1));
+ log.info("Stop node: " + g);
+
stopGrid(g);
Thread.sleep(rnd.nextInt(nodeLifeTime));
+ log.info("Start node: " + g);
+
startGrid(g);
Thread.sleep(rnd.nextInt(nodeLifeTime));
@@ -314,7 +318,7 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
return true;
}
- }, restartThreadsNum);
+ }, restartThreadsNum, "restart-thread");
Thread.sleep(duration);
[41/50] [abbrv] ignite git commit: Merge branch 'ignite-1.4'
Posted by sb...@apache.org.
Merge branch 'ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c1ac19df
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c1ac19df
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c1ac19df
Branch: refs/heads/ignite-1093-2
Commit: c1ac19df81bf3c77103f253b413bcaa133891c01
Parents: 403601b 2aa292c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 15:48:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 15:48:27 2015 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsFileWorkerBatch.java | 15 ++++-
.../processors/igfs/IgfsAbstractSelfTest.java | 60 +++++++++-----------
.../igfs/IgfsDualAbstractSelfTest.java | 10 +++-
.../testsuites/IgniteHadoopTestSuite.java | 6 +-
4 files changed, 52 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[24/50] [abbrv] ignite git commit: IGNITE-1465: Fixed.
Posted by sb...@apache.org.
IGNITE-1465: Fixed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f8b798d7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f8b798d7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f8b798d7
Branch: refs/heads/ignite-1093-2
Commit: f8b798d75c53e051ed2171441a2325e8d108300d
Parents: 961a467
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 09:34:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 09:34:27 2015 +0300
----------------------------------------------------------------------
.../internal/processors/hadoop/SecondaryFileSystemProvider.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b798d7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
index fdb61e8..d5be074 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
@@ -60,8 +60,8 @@ public class SecondaryFileSystemProvider {
if (url == null) {
// If secConfPath is given, it should be resolvable:
- throw new IllegalArgumentException("Failed to resolve secondary file system " +
- "configuration path: " + secConfPath);
+ throw new IllegalArgumentException("Failed to resolve secondary file system configuration path " +
+ "(ensure that it exists locally and you have read access to it): " + secConfPath);
}
cfg.addResource(url);
[35/50] [abbrv] ignite git commit: Release notes updated
Posted by sb...@apache.org.
Release notes updated
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9776134
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9776134
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9776134
Branch: refs/heads/ignite-1093-2
Commit: f9776134a7820b7ee82c60a11f62b4a0ab9ec4d1
Parents: a7490a6
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Sep 15 13:01:20 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Sep 15 13:01:20 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9776134/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 3f3ac7b..d7097fd 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -6,6 +6,7 @@ Apache Ignite In-Memory Data Fabric 1.4
* Added SSL support to communication and discovery.
* Added support for log4j2.
* Added versioned entry to cache API.
+* Added client node based JDBC driver implementation.
* Fixed IGNITE_HOME resolution with JBoss.
* Fixed configuration file resolution on classpath.
* Fixed MBean registration for caches.
[23/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/apache-main/ignite-1.4' into master-main
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/apache-main/ignite-1.4' into master-main
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7955c15a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7955c15a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7955c15a
Branch: refs/heads/ignite-1093-2
Commit: 7955c15a95f48559f2cc26568082d9a4139413ab
Parents: b736c46 961a467
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Sep 15 08:51:19 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Sep 15 08:51:19 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 -
examples/config/example-default.xml | 76 -
examples/config/example-ignite.xml | 56 +-
.../config/portable/example-ignite-portable.xml | 44 -
.../ignite/examples/portable/Address.java | 72 -
.../ignite/examples/portable/Employee.java | 93 -
.../ignite/examples/portable/EmployeeKey.java | 90 -
.../portable/ExamplePortableNodeStartup.java | 36 -
.../ignite/examples/portable/Organization.java | 93 -
.../examples/portable/OrganizationType.java | 32 -
...mputeClientPortableTaskExecutionExample.java | 154 -
.../portable/computegrid/ComputeClientTask.java | 116 -
.../portable/computegrid/package-info.java | 21 -
.../CacheClientPortablePutGetExample.java | 230 --
.../CacheClientPortableQueryExample.java | 325 --
.../portable/datagrid/package-info.java | 21 -
.../ignite/examples/portable/package-info.java | 21 -
.../CacheClientPortableExampleTest.java | 46 -
.../ComputeClientPortableExampleTest.java | 37 -
.../testsuites/IgniteExamplesSelfTestSuite.java | 6 -
modules/clients/pom.xml | 7 +
modules/clients/src/test/config/jdbc-config.xml | 55 +
.../jdbc2/JdbcComplexQuerySelfTest.java | 316 ++
.../internal/jdbc2/JdbcConnectionSelfTest.java | 268 ++
.../internal/jdbc2/JdbcEmptyCacheSelfTest.java | 140 +
.../internal/jdbc2/JdbcLocalCachesSelfTest.java | 156 +
.../internal/jdbc2/JdbcMetadataSelfTest.java | 334 ++
.../jdbc2/JdbcPreparedStatementSelfTest.java | 730 ++++
.../internal/jdbc2/JdbcResultSetSelfTest.java | 751 ++++
.../internal/jdbc2/JdbcStatementSelfTest.java | 292 ++
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 11 +
modules/core/pom.xml | 21 -
.../src/main/java/org/apache/ignite/Ignite.java | 7 -
.../java/org/apache/ignite/IgniteCache.java | 44 +-
.../org/apache/ignite/IgniteJdbcDriver.java | 281 +-
.../java/org/apache/ignite/IgnitePortables.java | 370 --
.../apache/ignite/IgniteSystemProperties.java | 5 +-
.../configuration/CacheConfiguration.java | 70 +-
.../ignite/internal/GridKernalContext.java | 7 +-
.../ignite/internal/GridKernalContextImpl.java | 10 +-
.../apache/ignite/internal/GridLoggerProxy.java | 6 +-
.../org/apache/ignite/internal/IgniteEx.java | 9 +
.../apache/ignite/internal/IgniteKernal.java | 14 +-
.../ignite/internal/IgniteNodeAttributes.java | 5 +-
.../internal/executor/GridExecutorService.java | 4 +-
.../ignite/internal/jdbc/JdbcConnection.java | 4 +
.../internal/jdbc/JdbcConnectionInfo.java | 91 -
.../internal/jdbc/JdbcDatabaseMetadata.java | 4 +
.../internal/jdbc/JdbcPreparedStatement.java | 4 +
.../ignite/internal/jdbc/JdbcResultSet.java | 4 +
.../internal/jdbc/JdbcResultSetMetadata.java | 4 +
.../ignite/internal/jdbc/JdbcStatement.java | 4 +
.../apache/ignite/internal/jdbc/JdbcUtils.java | 4 +
.../ignite/internal/jdbc2/JdbcConnection.java | 777 ++++
.../internal/jdbc2/JdbcDatabaseMetadata.java | 1401 +++++++
.../internal/jdbc2/JdbcPreparedStatement.java | 411 ++
.../ignite/internal/jdbc2/JdbcQueryTask.java | 361 ++
.../ignite/internal/jdbc2/JdbcResultSet.java | 1520 +++++++
.../internal/jdbc2/JdbcResultSetMetadata.java | 171 +
.../ignite/internal/jdbc2/JdbcStatement.java | 456 +++
.../apache/ignite/internal/jdbc2/JdbcUtils.java | 155 +
.../deployment/GridDeploymentStoreAdapter.java | 4 +-
.../discovery/GridDiscoveryManager.java | 10 -
.../portable/GridPortableMarshaller.java | 2 +-
.../portable/PortableClassDescriptor.java | 10 +-
.../internal/portable/PortableContext.java | 32 +-
.../portable/PortableMetaDataCollector.java | 6 +-
.../portable/PortableMetaDataHandler.java | 4 +-
.../internal/portable/PortableMetaDataImpl.java | 14 +-
.../internal/portable/PortableObjectEx.java | 6 +-
.../internal/portable/PortableObjectImpl.java | 6 +-
.../portable/PortableObjectOffheapImpl.java | 6 +-
.../internal/portable/PortableRawReaderEx.java | 4 +-
.../internal/portable/PortableRawWriterEx.java | 4 +-
.../portable/PortableReaderContext.java | 2 +-
.../internal/portable/PortableReaderExImpl.java | 10 +-
.../ignite/internal/portable/PortableUtils.java | 2 +-
.../internal/portable/PortableWriterExImpl.java | 11 +-
.../internal/portable/api/IgnitePortables.java | 362 ++
.../internal/portable/api/PortableBuilder.java | 136 +
.../portable/api/PortableException.java | 57 +
.../internal/portable/api/PortableIdMapper.java | 54 +
.../api/PortableInvalidClassException.java | 58 +
.../portable/api/PortableMarshalAware.java | 48 +
.../portable/api/PortableMarshaller.java | 358 ++
.../internal/portable/api/PortableMetadata.java | 60 +
.../internal/portable/api/PortableObject.java | 152 +
.../portable/api/PortableProtocolVersion.java | 41 +
.../portable/api/PortableRawReader.java | 234 ++
.../portable/api/PortableRawWriter.java | 219 +
.../internal/portable/api/PortableReader.java | 284 ++
.../portable/api/PortableSerializer.java | 47 +
.../portable/api/PortableTypeConfiguration.java | 195 +
.../internal/portable/api/PortableWriter.java | 266 ++
.../portable/builder/PortableBuilderEnum.java | 2 +-
.../portable/builder/PortableBuilderImpl.java | 14 +-
.../portable/builder/PortableBuilderReader.java | 2 +-
.../builder/PortableBuilderSerializer.java | 2 +-
.../builder/PortableEnumArrayLazyValue.java | 4 +-
.../builder/PortableObjectArrayLazyValue.java | 2 +-
.../builder/PortablePlainPortableObject.java | 2 +-
.../streams/PortableAbstractInputStream.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 10 +-
.../cache/GridCacheClearAllRunnable.java | 4 +-
.../processors/cache/GridCacheContext.java | 4 +-
.../processors/cache/GridCacheIoManager.java | 4 +-
.../processors/cache/GridCacheLogger.java | 4 +-
.../processors/cache/GridCacheMvcc.java | 5 +-
.../processors/cache/GridCacheProcessor.java | 8 +-
.../cache/GridCacheSharedContext.java | 4 +-
.../processors/cache/IgniteCacheProxy.java | 5 -
.../distributed/GridCacheTxRecoveryFuture.java | 11 +-
.../distributed/GridDistributedCacheEntry.java | 6 +-
.../GridDistributedTxFinishRequest.java | 13 +-
.../GridDistributedTxRemoteAdapter.java | 10 +-
.../distributed/dht/GridDhtLocalPartition.java | 1 +
.../dht/GridDhtTransactionalCacheAdapter.java | 514 ++-
.../distributed/dht/GridDhtTxFinishFuture.java | 15 +-
.../distributed/dht/GridDhtTxFinishRequest.java | 84 +-
.../dht/GridDhtTxFinishResponse.java | 89 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 4 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 67 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 32 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 40 +-
.../dht/GridPartitionedGetFuture.java | 4 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 4 +-
.../colocated/GridDhtColocatedLockFuture.java | 11 +-
.../distributed/near/GridNearLockFuture.java | 11 +-
.../distributed/near/GridNearLockRequest.java | 18 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 52 +-
.../GridNearPessimisticTxPrepareFuture.java | 11 +-
.../near/GridNearTxFinishFuture.java | 323 +-
.../near/GridNearTxFinishRequest.java | 20 +-
.../cache/distributed/near/GridNearTxLocal.java | 64 +-
.../distributed/near/GridNearTxRemote.java | 38 +-
.../CacheDefaultPortableAffinityKeyMapper.java | 2 +-
.../portable/CacheObjectPortableContext.java | 2 +-
.../portable/CacheObjectPortableProcessor.java | 8 +-
.../CacheObjectPortableProcessorImpl.java | 12 +-
.../cache/portable/IgnitePortablesImpl.java | 10 +-
.../cache/store/CacheOsStoreManager.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 5 +-
.../cache/transactions/IgniteTxHandler.java | 281 +-
.../transactions/IgniteTxLocalAdapter.java | 37 +-
.../cache/transactions/IgniteTxManager.java | 48 +-
.../datastructures/DataStructuresProcessor.java | 102 +-
.../datastructures/GridCacheAtomicLongImpl.java | 4 +-
.../GridCacheAtomicReferenceImpl.java | 4 +-
.../GridCacheAtomicSequenceImpl.java | 4 +-
.../GridCacheAtomicStampedImpl.java | 4 +-
.../GridCacheCountDownLatchImpl.java | 4 +-
.../GridTransactionalCacheQueueImpl.java | 15 +-
.../processors/igfs/IgfsFileAffinityRange.java | 4 +-
.../igfs/IgfsFragmentizerManager.java | 8 +-
.../processors/igfs/IgfsServerManager.java | 5 +-
.../internal/processors/job/GridJobWorker.java | 4 +-
.../dotnet/PlatformDotNetConfiguration.java | 12 +-
.../PlatformDotNetPortableConfiguration.java | 12 +-
...PlatformDotNetPortableTypeConfiguration.java | 12 +-
.../processors/task/GridTaskWorker.java | 4 +-
.../util/GridSpiCloseableIteratorWrapper.java | 5 +
.../marshaller/portable/PortableMarshaller.java | 358 --
.../marshaller/portable/package-info.java | 22 -
.../apache/ignite/portable/PortableBuilder.java | 137 -
.../ignite/portable/PortableException.java | 57 -
.../ignite/portable/PortableIdMapper.java | 56 -
.../portable/PortableInvalidClassException.java | 58 -
.../ignite/portable/PortableMarshalAware.java | 48 -
.../ignite/portable/PortableMetadata.java | 61 -
.../apache/ignite/portable/PortableObject.java | 154 -
.../portable/PortableProtocolVersion.java | 41 -
.../ignite/portable/PortableRawReader.java | 234 --
.../ignite/portable/PortableRawWriter.java | 219 -
.../apache/ignite/portable/PortableReader.java | 284 --
.../ignite/portable/PortableSerializer.java | 49 -
.../portable/PortableTypeConfiguration.java | 196 -
.../apache/ignite/portable/PortableWriter.java | 266 --
.../apache/ignite/portable/package-info.java | 22 -
.../resources/META-INF/classnames.properties | 20 +-
.../GridDiscoveryManagerAttributesSelfTest.java | 45 -
.../GridPortableAffinityKeySelfTest.java | 218 -
.../GridPortableBuilderAdditionalSelfTest.java | 1226 ------
.../portable/GridPortableBuilderSelfTest.java | 1021 -----
...eBuilderStringAsCharsAdditionalSelfTest.java | 28 -
...ridPortableBuilderStringAsCharsSelfTest.java | 28 -
...idPortableMarshallerCtxDisabledSelfTest.java | 256 --
.../GridPortableMarshallerSelfTest.java | 3807 ------------------
.../GridPortableMetaDataDisabledSelfTest.java | 238 --
.../portable/GridPortableMetaDataSelfTest.java | 369 --
.../portable/GridPortableWildcardsSelfTest.java | 482 ---
.../GridPortableMarshalerAwareTestClass.java | 67 -
.../mutabletest/GridPortableTestClasses.java | 434 --
.../portable/mutabletest/package-info.java | 22 -
.../ignite/internal/portable/package-info.java | 22 -
.../portable/test/GridPortableTestClass1.java | 28 -
.../portable/test/GridPortableTestClass2.java | 24 -
.../internal/portable/test/package-info.java | 22 -
.../test/subpackage/GridPortableTestClass3.java | 24 -
.../portable/test/subpackage/package-info.java | 22 -
.../CacheStoreUsageMultinodeAbstractTest.java | 16 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 50 +-
.../processors/cache/GridCacheMvccSelfTest.java | 4 +-
.../cache/GridCacheP2PUndeploySelfTest.java | 30 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 28 +-
.../GridCacheVariableTopologySelfTest.java | 5 +-
.../cache/IgniteCachePutAllRestartTest.java | 2 +
.../cache/IgniteInternalCacheTypesTest.java | 4 +-
.../cache/IgniteOnePhaseCommitNearSelfTest.java | 243 ++
.../IgniteTxExceptionAbstractSelfTest.java | 29 +-
...ridCachePartitionNotLoadedEventSelfTest.java | 27 +-
.../GridCacheTransformEventSelfTest.java | 5 +-
.../GridCacheColocatedTxExceptionSelfTest.java | 2 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 405 ++
.../dht/GridNearCacheTxNodeFailureSelfTest.java | 31 +
...gniteAtomicLongChangingTopologySelfTest.java | 278 ++
.../near/GridCacheNearTxExceptionSelfTest.java | 2 +-
.../near/IgniteCacheNearOnlyTxTest.java | 14 +-
.../GridCacheReplicatedTxExceptionSelfTest.java | 2 +-
.../GridCacheLocalTxExceptionSelfTest.java | 2 +-
...ClientNodePortableMetadataMultinodeTest.java | 295 --
...GridCacheClientNodePortableMetadataTest.java | 286 --
...ableObjectsAbstractDataStreamerSelfTest.java | 190 -
...bleObjectsAbstractMultiThreadedSelfTest.java | 231 --
...ridCachePortableObjectsAbstractSelfTest.java | 978 -----
.../GridCachePortableStoreAbstractSelfTest.java | 297 --
.../GridCachePortableStoreObjectsSelfTest.java | 55 -
...GridCachePortableStorePortablesSelfTest.java | 66 -
...ridPortableCacheEntryMemorySizeSelfTest.java | 55 -
...leDuplicateIndexObjectsAbstractSelfTest.java | 158 -
.../DataStreamProcessorPortableSelfTest.java | 66 -
.../GridDataStreamerImplSelfTest.java | 345 --
...ridCacheAffinityRoutingPortableSelfTest.java | 47 -
...lyPortableDataStreamerMultiNodeSelfTest.java | 29 -
...rtableDataStreamerMultithreadedSelfTest.java | 47 -
...artitionedOnlyPortableMultiNodeSelfTest.java | 28 -
...tionedOnlyPortableMultithreadedSelfTest.java | 47 -
.../GridCacheMemoryModePortableSelfTest.java | 36 -
...acheOffHeapTieredAtomicPortableSelfTest.java | 47 -
...eapTieredEvictionAtomicPortableSelfTest.java | 95 -
...heOffHeapTieredEvictionPortableSelfTest.java | 95 -
.../GridCacheOffHeapTieredPortableSelfTest.java | 47 -
...ateIndexObjectPartitionedAtomicSelfTest.java | 38 -
...xObjectPartitionedTransactionalSelfTest.java | 41 -
...AtomicNearDisabledOffheapTieredSelfTest.java | 29 -
...rtableObjectsAtomicNearDisabledSelfTest.java | 51 -
...tableObjectsAtomicOffheapTieredSelfTest.java | 29 -
.../GridCachePortableObjectsAtomicSelfTest.java | 51 -
...tionedNearDisabledOffheapTieredSelfTest.java | 30 -
...eObjectsPartitionedNearDisabledSelfTest.java | 51 -
...ObjectsPartitionedOffheapTieredSelfTest.java | 30 -
...CachePortableObjectsPartitionedSelfTest.java | 51 -
...sNearPartitionedByteArrayValuesSelfTest.java | 41 -
...sPartitionedOnlyByteArrayValuesSelfTest.java | 42 -
...dCachePortableObjectsReplicatedSelfTest.java | 51 -
...CachePortableObjectsAtomicLocalSelfTest.java | 32 -
...rtableObjectsLocalOffheapTieredSelfTest.java | 29 -
.../GridCachePortableObjectsLocalSelfTest.java | 51 -
.../processors/igfs/IgfsStartCacheTest.java | 2 +-
.../stream/socket/SocketStreamerSelfTest.java | 27 +-
.../ignite/testframework/junits/IgniteMock.java | 8 +-
.../multijvm/IgniteCacheProcessProxy.java | 5 -
.../junits/multijvm/IgniteProcessProxy.java | 2 +-
.../IgniteCacheFailoverTestSuite.java | 9 +-
.../IgnitePortableCacheFullApiTestSuite.java | 37 -
.../IgnitePortableCacheTestSuite.java | 103 -
.../IgnitePortableObjectsTestSuite.java | 92 -
.../ignite/portable/test1/1.1/test1-1.1.jar | Bin 2548 -> 0 bytes
.../ignite/portable/test1/1.1/test1-1.1.pom | 9 -
.../portable/test1/maven-metadata-local.xml | 12 -
.../ignite/portable/test2/1.1/test2-1.1.jar | Bin 1361 -> 0 bytes
.../ignite/portable/test2/1.1/test2-1.1.pom | 9 -
.../portable/test2/maven-metadata-local.xml | 12 -
.../HadoopDefaultMapReducePlannerSelfTest.java | 6 +
...CacheScanPartitionQueryFallbackSelfTest.java | 105 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 2 +
.../IgniteCacheReplicatedQuerySelfTest.java | 49 +-
.../IgnitePortableCacheQueryTestSuite.java | 117 -
.../platform/PlatformContextImpl.java | 4 +-
.../platform/compute/PlatformCompute.java | 2 +-
.../cpp/PlatformCppConfigurationClosure.java | 2 +-
.../PlatformDotNetConfigurationClosure.java | 6 +-
.../platform/events/PlatformEvents.java | 2 +-
.../services/PlatformAbstractService.java | 3 +-
.../Cache/CacheAbstractTest.cs | 71 +-
.../Config/Compute/compute-grid1.xml | 8 +-
.../PlatformComputePortableArgTask.java | 8 +-
.../ignite/schema/generator/CodeGenerator.java | 4 +-
.../ignite/schema/model/PojoDescriptor.java | 6 +-
.../parser/dialect/OracleMetadataDialect.java | 7 +-
.../org/apache/ignite/IgniteSpringBean.java | 7 -
.../yardstick/config/benchmark-query.properties | 5 +-
modules/yardstick/config/ignite-base-config.xml | 2 +-
modules/yardstick/config/ignite-jdbc-config.xml | 55 +
parent/pom.xml | 10 -
pom.xml | 10 +
295 files changed, 14010 insertions(+), 18529 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7955c15a/modules/clients/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7955c15a/modules/core/pom.xml
----------------------------------------------------------------------
diff --cc modules/core/pom.xml
index e02bb23,9162afe..6467119
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@@ -31,16 -31,9 +31,9 @@@
</parent>
<artifactId>ignite-core</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <repositories>
- <repository>
- <id>ignite-portables-test-repo</id>
- <url>file://${basedir}/src/test/portables/repo</url>
- </repository>
- </repositories>
-
<properties>
<ignite.update.notifier.product>apache-ignite</ignite.update.notifier.product>
</properties>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7955c15a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7955c15a/pom.xml
----------------------------------------------------------------------
[39/50] [abbrv] ignite git commit: IGNITE-1376: Fixed test clear
routine.
Posted by sb...@apache.org.
IGNITE-1376: Fixed test clear routine.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3f75c1c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3f75c1c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3f75c1c4
Branch: refs/heads/ignite-1093-2
Commit: 3f75c1c4427dc32d990560d0b8dc80a191f5f666
Parents: 367d805
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 15:31:42 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 15:31:42 2015 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsFileWorkerBatch.java | 15 ++++-
.../processors/igfs/IgfsAbstractSelfTest.java | 60 +++++++++-----------
.../igfs/IgfsDualAbstractSelfTest.java | 10 +++-
3 files changed, 49 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f75c1c4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileWorkerBatch.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileWorkerBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileWorkerBatch.java
index 6bea187..130846b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileWorkerBatch.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileWorkerBatch.java
@@ -49,6 +49,9 @@ public abstract class IgfsFileWorkerBatch implements Runnable {
/** Output stream to the file. */
private final OutputStream out;
+ /** Cancel flag. */
+ private volatile boolean cancelled;
+
/** Finishing flag. */
private volatile boolean finishing;
@@ -108,6 +111,13 @@ public abstract class IgfsFileWorkerBatch implements Runnable {
}
/**
+ * @return {@code True} if batch write was terminated abruptly due to explicit cancellation.
+ */
+ boolean cancelled() {
+ return cancelled;
+ }
+
+ /**
* Process the batch.
*/
@SuppressWarnings("unchecked")
@@ -124,8 +134,11 @@ public abstract class IgfsFileWorkerBatch implements Runnable {
break;
}
- else if (data == CANCEL_MARKER)
+ else if (data == CANCEL_MARKER) {
+ cancelled = true;
+
throw new IgniteCheckedException("Write to file was cancelled due to node stop.");
+ }
else if (data != null) {
try {
out.write(data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f75c1c4/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 7513bb8..957363f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -188,8 +188,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
/**
* Constructor.
*
- * @param mode
- * @param memoryMode
+ * @param mode IGFS mode.
+ * @param memoryMode Memory mode.
*/
protected IgfsAbstractSelfTest(IgfsMode mode, CacheMemoryMode memoryMode) {
assert mode != null && mode != PROXY;
@@ -201,9 +201,10 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * Data chunk.
*
- * @param length
- * @return
+ * @param length Length.
+ * @return Data chunk.
*/
static byte[] createChunk(int length) {
byte[] chunk = new byte[length];
@@ -255,6 +256,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
* @return Started grid instance.
* @throws Exception If failed.
*/
+ @SuppressWarnings("unchecked")
protected Ignite startGridWithIgfs(String gridName, String igfsName, IgfsMode mode,
@Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable IgfsIpcEndpointConfiguration restCfg) throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
@@ -309,9 +311,10 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * Prepare cache configuration.
*
- * @param dataCacheCfg
- * @param metaCacheCfg
+ * @param dataCacheCfg Data cache configuration.
+ * @param metaCacheCfg Meta cache configuration.
*/
protected void prepareCacheConfigurations(CacheConfiguration dataCacheCfg, CacheConfiguration metaCacheCfg) {
// Noop
@@ -782,9 +785,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
boolean ok = igfs.delete(SUBDIR, false);
assertFalse(ok);
- } catch (IgfsDirectoryNotEmptyException idnee) {
- // ok, expected
- U.debug("Expected: " + idnee);
+ }
+ catch (IgfsDirectoryNotEmptyException ignore) {
+ // No-op, expected.
}
checkExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE);
@@ -841,7 +844,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
/**
* Ensure that formatting is not propagated to the secondary file system.
- *
+ *
* TODO: IGNITE-586.
*
* @throws Exception If failed.
@@ -850,7 +853,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
public void testFormat() throws Exception {
// Test works too long and fails.
fail("https://issues.apache.org/jira/browse/IGNITE-586");
-
+
IgniteKernal grid = (IgniteKernal)G.ignite("grid");
GridCacheAdapter cache = grid.internalCache("dataCache");
@@ -2249,6 +2252,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
}
+ @SuppressWarnings("EmptyTryBlock")
public void create(UniversalFileSystemAdapter uni, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception {
if (dirs != null) {
for (IgfsPath dir : dirs)
@@ -2257,8 +2261,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
if (files != null) {
for (IgfsPath file : files)
- try (OutputStream os = uni.openOutputStream(file.toString(), false)) {
- // noop
+ try (OutputStream ignore = uni.openOutputStream(file.toString(), false)) {
+ // No-op
}
}
}
@@ -2291,12 +2295,12 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
/**
* Create the file in the given IGFS and write provided data chunks to it.
*
+ * @param uni File system adapter.
* @param file File.
- * @param overwrite Overwrite flag.
* @param chunks Data chunks.
* @throws IOException In case of IO exception.
*/
- protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, boolean overwrite, @Nullable byte[]... chunks)
+ protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, @Nullable byte[]... chunks)
throws IOException {
OutputStream os = null;
@@ -2658,7 +2662,14 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
for (Map.Entry<IgfsPath, IgfsFileWorkerBatch> entry : workerMap.entrySet()) {
entry.getValue().cancel();
- entry.getValue().await();
+
+ try {
+ entry.getValue().await();
+ }
+ catch (IgniteCheckedException e) {
+ if (!entry.getValue().cancelled())
+ throw e;
+ }
}
// Clear igfs.
@@ -2675,21 +2686,6 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
public static void clear(UniversalFileSystemAdapter uni) throws Exception {
IgfsEx igfsEx = uni.getAdapter(IgfsEx.class);
- if (igfsEx != null) {
- Field workerMapFld = IgfsImpl.class.getDeclaredField("workerMap");
-
- workerMapFld.setAccessible(true);
-
- // Wait for all workers to finish.
- Map<IgfsPath, IgfsFileWorkerBatch> workerMap = (Map<IgfsPath, IgfsFileWorkerBatch>)workerMapFld.get(igfs);
-
- for (Map.Entry<IgfsPath, IgfsFileWorkerBatch> entry : workerMap.entrySet()) {
- entry.getValue().cancel();
- entry.getValue().await();
- }
- }
-
- // Clear the filesystem:
- uni.format();
+ clear(igfsEx);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3f75c1c4/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
index 0141173..683054b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
@@ -1129,7 +1129,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
create(igfsSecondary, paths(DIR, SUBDIR), null);
create(igfs, null, null);
- createFile(igfsSecondary, FILE, true, chunk);
+ createFile(igfsSecondary, FILE, chunk);
checkFileContent(igfs, FILE, chunk);
}
@@ -1139,6 +1139,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
*
* @throws Exception If failed.
*/
+ @SuppressWarnings({"ResultOfMethodCallIgnored", "ThrowableResultOfMethodCallIgnored"})
public void testOpenNoPrefetch() throws Exception {
create(igfsSecondary, paths(DIR, SUBDIR), paths(FILE));
@@ -1216,6 +1217,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
*
* @throws Exception If failed.
*/
+ @SuppressWarnings("ResultOfMethodCallIgnored")
public void testOpenPrefetch() throws Exception {
create(igfsSecondary, paths(DIR, SUBDIR), paths(FILE));
@@ -1251,6 +1253,8 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
IgfsFileInfo info = meta.info(meta.fileId(FILE));
+ assert info != null;
+
IgfsBlockKey key = new IgfsBlockKey(info.id(), info.affinityKey(), info.evictExclude(), 2);
IgniteCache<IgfsBlockKey, byte[]> dataCache = igfs.context().kernalContext().cache().jcache(
@@ -1344,7 +1348,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
igfsSecondaryFileSystem.update(SUBDIR, props);
- createFile(igfsSecondary, FILE, true, /*BLOCK_SIZE,*/ chunk);
+ createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk);
appendFile(igfs, FILE, chunk);
@@ -1371,7 +1375,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
igfsSecondaryFileSystem.update(DIR, propsDir);
igfsSecondaryFileSystem.update(SUBDIR, propsSubDir);
- createFile(igfsSecondary, FILE, true, /*BLOCK_SIZE,*/ chunk);
+ createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk);
appendFile(igfs, FILE, chunk);
[21/50] [abbrv] ignite git commit: Merge branch 'ignite-1.4' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.4
Posted by sb...@apache.org.
Merge branch 'ignite-1.4' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d39345b8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d39345b8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d39345b8
Branch: refs/heads/ignite-1093-2
Commit: d39345b874097d8f6852b35c9d47c8037c13d19b
Parents: c70680a cc0d1f5
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 18:55:54 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 18:55:54 2015 -0700
----------------------------------------------------------------------
.../org/apache/ignite/internal/GridKernalContext.java | 7 ++++---
.../org/apache/ignite/internal/GridKernalContextImpl.java | 10 +++++-----
.../java/org/apache/ignite/internal/GridLoggerProxy.java | 6 ++++--
.../java/org/apache/ignite/internal/IgniteKernal.java | 6 +++---
.../ignite/internal/executor/GridExecutorService.java | 4 ++--
.../managers/deployment/GridDeploymentStoreAdapter.java | 4 ++--
.../internal/processors/cache/GridCacheAdapter.java | 4 ++--
.../processors/cache/GridCacheClearAllRunnable.java | 4 ++--
.../ignite/internal/processors/cache/GridCacheLogger.java | 4 ++--
.../internal/processors/cache/GridCacheSharedContext.java | 4 ++--
.../datastructures/GridCacheAtomicLongImpl.java | 4 ++--
.../datastructures/GridCacheAtomicReferenceImpl.java | 4 ++--
.../datastructures/GridCacheAtomicSequenceImpl.java | 4 ++--
.../datastructures/GridCacheAtomicStampedImpl.java | 4 ++--
.../datastructures/GridCacheCountDownLatchImpl.java | 4 ++--
.../internal/processors/igfs/IgfsFragmentizerManager.java | 8 +++++---
.../internal/processors/igfs/IgfsServerManager.java | 5 +++--
.../ignite/internal/processors/job/GridJobWorker.java | 4 ++--
.../ignite/internal/processors/task/GridTaskWorker.java | 4 ++--
19 files changed, 50 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
[50/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-1093-2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1093-2
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/25db29bc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/25db29bc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/25db29bc
Branch: refs/heads/ignite-1093-2
Commit: 25db29bcb279b71b8158b7856f92f68679d95ed6
Parents: fdfa62f 6e48c9c
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Sep 15 20:20:00 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Sep 15 20:20:00 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 2 +-
examples/config/example-default.xml | 76 -
examples/config/example-ignite.xml | 56 +-
examples/config/filesystem/README.txt | 2 +-
examples/config/filesystem/example-igfs.xml | 7 -
.../config/portable/example-ignite-portable.xml | 44 -
.../ignite/examples/portable/Address.java | 72 -
.../ignite/examples/portable/Employee.java | 93 -
.../ignite/examples/portable/EmployeeKey.java | 90 -
.../portable/ExamplePortableNodeStartup.java | 36 -
.../ignite/examples/portable/Organization.java | 93 -
.../examples/portable/OrganizationType.java | 32 -
...mputeClientPortableTaskExecutionExample.java | 154 -
.../portable/computegrid/ComputeClientTask.java | 116 -
.../portable/computegrid/package-info.java | 21 -
.../CacheClientPortablePutGetExample.java | 230 --
.../CacheClientPortableQueryExample.java | 325 --
.../portable/datagrid/package-info.java | 21 -
.../ignite/examples/portable/package-info.java | 21 -
.../CacheClientPortableExampleTest.java | 46 -
.../ComputeClientPortableExampleTest.java | 37 -
.../testsuites/IgniteExamplesSelfTestSuite.java | 6 -
modules/clients/pom.xml | 7 +
modules/clients/src/test/config/jdbc-config.xml | 55 +
.../jdbc2/JdbcComplexQuerySelfTest.java | 316 ++
.../internal/jdbc2/JdbcConnectionSelfTest.java | 268 ++
.../internal/jdbc2/JdbcEmptyCacheSelfTest.java | 140 +
.../internal/jdbc2/JdbcLocalCachesSelfTest.java | 156 +
.../internal/jdbc2/JdbcMetadataSelfTest.java | 334 ++
.../jdbc2/JdbcPreparedStatementSelfTest.java | 730 ++++
.../internal/jdbc2/JdbcResultSetSelfTest.java | 751 ++++
.../internal/jdbc2/JdbcStatementSelfTest.java | 292 ++
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 11 +
modules/core/pom.xml | 21 -
.../src/main/java/org/apache/ignite/Ignite.java | 7 -
.../java/org/apache/ignite/IgniteCache.java | 44 +-
.../org/apache/ignite/IgniteJdbcDriver.java | 281 +-
.../java/org/apache/ignite/IgnitePortables.java | 370 --
.../apache/ignite/IgniteSystemProperties.java | 5 +-
.../configuration/CacheConfiguration.java | 68 +-
.../ignite/internal/GridKernalContext.java | 7 +-
.../ignite/internal/GridKernalContextImpl.java | 10 +-
.../apache/ignite/internal/GridLoggerProxy.java | 6 +-
.../org/apache/ignite/internal/IgniteEx.java | 9 +
.../apache/ignite/internal/IgniteKernal.java | 14 +-
.../ignite/internal/IgniteNodeAttributes.java | 7 +-
.../internal/executor/GridExecutorService.java | 4 +-
.../ignite/internal/jdbc/JdbcConnection.java | 4 +
.../internal/jdbc/JdbcConnectionInfo.java | 91 -
.../internal/jdbc/JdbcDatabaseMetadata.java | 4 +
.../internal/jdbc/JdbcPreparedStatement.java | 4 +
.../ignite/internal/jdbc/JdbcResultSet.java | 4 +
.../internal/jdbc/JdbcResultSetMetadata.java | 4 +
.../ignite/internal/jdbc/JdbcStatement.java | 4 +
.../apache/ignite/internal/jdbc/JdbcUtils.java | 4 +
.../ignite/internal/jdbc2/JdbcConnection.java | 777 ++++
.../internal/jdbc2/JdbcDatabaseMetadata.java | 1401 +++++++
.../internal/jdbc2/JdbcPreparedStatement.java | 411 ++
.../ignite/internal/jdbc2/JdbcQueryTask.java | 361 ++
.../ignite/internal/jdbc2/JdbcResultSet.java | 1520 +++++++
.../internal/jdbc2/JdbcResultSetMetadata.java | 171 +
.../ignite/internal/jdbc2/JdbcStatement.java | 456 +++
.../apache/ignite/internal/jdbc2/JdbcUtils.java | 155 +
.../deployment/GridDeploymentStoreAdapter.java | 4 +-
.../discovery/GridDiscoveryManager.java | 10 -
.../portable/GridPortableMarshaller.java | 2 +-
.../portable/PortableClassDescriptor.java | 10 +-
.../internal/portable/PortableContext.java | 32 +-
.../portable/PortableMetaDataCollector.java | 6 +-
.../portable/PortableMetaDataHandler.java | 4 +-
.../internal/portable/PortableMetaDataImpl.java | 14 +-
.../internal/portable/PortableObjectEx.java | 6 +-
.../internal/portable/PortableObjectImpl.java | 6 +-
.../portable/PortableObjectOffheapImpl.java | 6 +-
.../internal/portable/PortableRawReaderEx.java | 4 +-
.../internal/portable/PortableRawWriterEx.java | 4 +-
.../portable/PortableReaderContext.java | 2 +-
.../internal/portable/PortableReaderExImpl.java | 10 +-
.../ignite/internal/portable/PortableUtils.java | 2 +-
.../internal/portable/PortableWriterExImpl.java | 11 +-
.../internal/portable/api/IgnitePortables.java | 362 ++
.../internal/portable/api/PortableBuilder.java | 136 +
.../portable/api/PortableException.java | 57 +
.../internal/portable/api/PortableIdMapper.java | 54 +
.../api/PortableInvalidClassException.java | 58 +
.../portable/api/PortableMarshalAware.java | 48 +
.../portable/api/PortableMarshaller.java | 358 ++
.../internal/portable/api/PortableMetadata.java | 60 +
.../internal/portable/api/PortableObject.java | 152 +
.../portable/api/PortableProtocolVersion.java | 41 +
.../portable/api/PortableRawReader.java | 234 ++
.../portable/api/PortableRawWriter.java | 219 +
.../internal/portable/api/PortableReader.java | 284 ++
.../portable/api/PortableSerializer.java | 47 +
.../portable/api/PortableTypeConfiguration.java | 195 +
.../internal/portable/api/PortableWriter.java | 266 ++
.../portable/builder/PortableBuilderEnum.java | 2 +-
.../portable/builder/PortableBuilderImpl.java | 14 +-
.../portable/builder/PortableBuilderReader.java | 2 +-
.../builder/PortableBuilderSerializer.java | 2 +-
.../builder/PortableEnumArrayLazyValue.java | 4 +-
.../builder/PortableObjectArrayLazyValue.java | 2 +-
.../builder/PortablePlainPortableObject.java | 2 +-
.../streams/PortableAbstractInputStream.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 31 +-
.../cache/GridCacheClearAllRunnable.java | 4 +-
.../processors/cache/GridCacheContext.java | 4 +-
.../processors/cache/GridCacheIoManager.java | 2 +-
.../processors/cache/GridCacheLogger.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 15 +-
.../processors/cache/GridCacheMvcc.java | 5 +-
.../processors/cache/GridCacheProcessor.java | 37 +-
.../cache/GridCacheSharedContext.java | 4 +-
.../processors/cache/GridCacheSwapManager.java | 46 +-
.../processors/cache/IgniteCacheProxy.java | 5 -
.../distributed/GridCacheTxRecoveryFuture.java | 11 +-
.../distributed/GridDistributedCacheEntry.java | 6 +-
.../GridDistributedTxFinishRequest.java | 13 +-
.../GridDistributedTxRemoteAdapter.java | 18 +-
.../dht/GridClientPartitionTopology.java | 104 +-
.../distributed/dht/GridDhtLocalPartition.java | 1 +
.../dht/GridDhtPartitionTopology.java | 4 +-
.../dht/GridDhtPartitionTopologyImpl.java | 16 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 514 ++-
.../distributed/dht/GridDhtTxFinishFuture.java | 15 +-
.../distributed/dht/GridDhtTxFinishRequest.java | 84 +-
.../dht/GridDhtTxFinishResponse.java | 89 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 4 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 67 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 34 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 40 +-
.../dht/GridPartitionedGetFuture.java | 4 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 4 +-
.../colocated/GridDhtColocatedLockFuture.java | 11 +-
.../distributed/near/GridNearLockFuture.java | 11 +-
.../distributed/near/GridNearLockRequest.java | 18 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 55 +-
.../GridNearPessimisticTxPrepareFuture.java | 11 +-
.../near/GridNearTxFinishFuture.java | 345 +-
.../near/GridNearTxFinishRequest.java | 20 +-
.../cache/distributed/near/GridNearTxLocal.java | 64 +-
.../distributed/near/GridNearTxRemote.java | 38 +-
.../CacheDefaultPortableAffinityKeyMapper.java | 2 +-
.../portable/CacheObjectPortableContext.java | 2 +-
.../portable/CacheObjectPortableProcessor.java | 8 +-
.../CacheObjectPortableProcessorImpl.java | 12 +-
.../cache/portable/IgnitePortablesImpl.java | 10 +-
.../cache/store/CacheOsStoreManager.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 5 +-
.../cache/transactions/IgniteTxHandler.java | 286 +-
.../transactions/IgniteTxLocalAdapter.java | 37 +-
.../cache/transactions/IgniteTxManager.java | 48 +-
.../continuous/GridContinuousProcessor.java | 22 +-
.../datastructures/DataStructuresProcessor.java | 102 +-
.../datastructures/GridCacheAtomicLongImpl.java | 4 +-
.../GridCacheAtomicReferenceImpl.java | 4 +-
.../GridCacheAtomicSequenceImpl.java | 4 +-
.../GridCacheAtomicStampedImpl.java | 4 +-
.../GridCacheCountDownLatchImpl.java | 4 +-
.../GridTransactionalCacheQueueImpl.java | 15 +-
.../processors/igfs/IgfsFileAffinityRange.java | 4 +-
.../processors/igfs/IgfsFileWorkerBatch.java | 15 +-
.../igfs/IgfsFragmentizerManager.java | 8 +-
.../processors/igfs/IgfsServerManager.java | 5 +-
.../internal/processors/job/GridJobWorker.java | 4 +-
.../dotnet/PlatformDotNetConfiguration.java | 12 +-
.../PlatformDotNetPortableConfiguration.java | 12 +-
...PlatformDotNetPortableTypeConfiguration.java | 12 +-
.../processors/task/GridTaskWorker.java | 4 +-
.../util/GridSpiCloseableIteratorWrapper.java | 5 +
.../ignite/internal/util/IgniteUtils.java | 16 +
.../util/offheap/GridOffHeapEvictListener.java | 2 +-
.../util/offheap/GridOffHeapPartitionedMap.java | 1 +
.../util/offheap/unsafe/GridUnsafeMap.java | 4 +-
.../marshaller/portable/PortableMarshaller.java | 358 --
.../marshaller/portable/package-info.java | 22 -
.../apache/ignite/portable/PortableBuilder.java | 137 -
.../ignite/portable/PortableException.java | 57 -
.../ignite/portable/PortableIdMapper.java | 56 -
.../portable/PortableInvalidClassException.java | 58 -
.../ignite/portable/PortableMarshalAware.java | 48 -
.../ignite/portable/PortableMetadata.java | 61 -
.../apache/ignite/portable/PortableObject.java | 154 -
.../portable/PortableProtocolVersion.java | 41 -
.../ignite/portable/PortableRawReader.java | 234 --
.../ignite/portable/PortableRawWriter.java | 219 -
.../apache/ignite/portable/PortableReader.java | 284 --
.../ignite/portable/PortableSerializer.java | 49 -
.../portable/PortableTypeConfiguration.java | 196 -
.../apache/ignite/portable/PortableWriter.java | 266 --
.../apache/ignite/portable/package-info.java | 22 -
.../resources/META-INF/classnames.properties | 20 +-
.../GridDiscoveryManagerAttributesSelfTest.java | 45 -
.../GridPortableAffinityKeySelfTest.java | 218 -
.../GridPortableBuilderAdditionalSelfTest.java | 1226 ------
.../portable/GridPortableBuilderSelfTest.java | 1021 -----
...eBuilderStringAsCharsAdditionalSelfTest.java | 28 -
...ridPortableBuilderStringAsCharsSelfTest.java | 28 -
...idPortableMarshallerCtxDisabledSelfTest.java | 256 --
.../GridPortableMarshallerSelfTest.java | 3807 ------------------
.../GridPortableMetaDataDisabledSelfTest.java | 238 --
.../portable/GridPortableMetaDataSelfTest.java | 369 --
.../portable/GridPortableWildcardsSelfTest.java | 482 ---
.../GridPortableMarshalerAwareTestClass.java | 67 -
.../mutabletest/GridPortableTestClasses.java | 434 --
.../portable/mutabletest/package-info.java | 22 -
.../ignite/internal/portable/package-info.java | 22 -
.../portable/test/GridPortableTestClass1.java | 28 -
.../portable/test/GridPortableTestClass2.java | 24 -
.../internal/portable/test/package-info.java | 22 -
.../test/subpackage/GridPortableTestClass3.java | 24 -
.../portable/test/subpackage/package-info.java | 22 -
.../CacheStoreUsageMultinodeAbstractTest.java | 16 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 57 +-
.../GridCacheAbstractRemoveFailureTest.java | 199 +-
.../cache/GridCacheMemoryModeSelfTest.java | 9 +-
.../processors/cache/GridCacheMvccSelfTest.java | 4 +-
.../cache/GridCacheP2PUndeploySelfTest.java | 30 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 88 +-
.../GridCacheVariableTopologySelfTest.java | 5 +-
.../cache/IgniteCacheCreateRestartSelfTest.java | 106 +
.../IgniteCacheEntryProcessorNodeJoinTest.java | 73 +
.../cache/IgniteCachePutAllRestartTest.java | 2 +
.../cache/IgniteInternalCacheTypesTest.java | 4 +-
.../cache/IgniteOnePhaseCommitNearSelfTest.java | 243 ++
.../IgniteTxExceptionAbstractSelfTest.java | 29 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 149 +-
...ridCachePartitionNotLoadedEventSelfTest.java | 27 +-
.../GridCacheTransformEventSelfTest.java | 5 +-
.../GridCacheColocatedTxExceptionSelfTest.java | 2 +-
.../GridCacheDhtAtomicRemoveFailureTest.java | 16 +-
.../dht/GridCacheDhtRemoveFailureTest.java | 16 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 405 ++
.../dht/GridNearCacheTxNodeFailureSelfTest.java | 31 +
...gniteAtomicLongChangingTopologySelfTest.java | 278 ++
.../IgniteCacheCrossCacheTxFailoverTest.java | 53 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 166 +-
.../dht/IgniteCachePutRetryAtomicSelfTest.java | 2 +
...gniteCachePutRetryTransactionalSelfTest.java | 50 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 98 +-
...tomicPrimaryWriteOrderRemoveFailureTest.java | 15 +-
.../GridCacheAtomicRemoveFailureTest.java | 15 +-
.../GridCacheAtomicNearRemoveFailureTest.java | 15 +-
...cPrimaryWriteOrderNearRemoveFailureTest.java | 15 +-
.../near/GridCacheNearRemoveFailureTest.java | 15 +-
.../near/GridCacheNearTxExceptionSelfTest.java | 2 +-
.../GridCachePartitionedNodeRestartTest.java | 9 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 9 +-
.../near/IgniteCacheNearOnlyTxTest.java | 14 +-
.../GridCacheReplicatedNodeRestartSelfTest.java | 8 +-
.../GridCacheReplicatedTxExceptionSelfTest.java | 2 +-
.../GridCacheLocalTxExceptionSelfTest.java | 2 +-
...ClientNodePortableMetadataMultinodeTest.java | 295 --
...GridCacheClientNodePortableMetadataTest.java | 286 --
...ableObjectsAbstractDataStreamerSelfTest.java | 190 -
...bleObjectsAbstractMultiThreadedSelfTest.java | 231 --
...ridCachePortableObjectsAbstractSelfTest.java | 978 -----
.../GridCachePortableStoreAbstractSelfTest.java | 297 --
.../GridCachePortableStoreObjectsSelfTest.java | 55 -
...GridCachePortableStorePortablesSelfTest.java | 66 -
...ridPortableCacheEntryMemorySizeSelfTest.java | 55 -
...leDuplicateIndexObjectsAbstractSelfTest.java | 158 -
.../DataStreamProcessorPortableSelfTest.java | 66 -
.../GridDataStreamerImplSelfTest.java | 345 --
...ridCacheAffinityRoutingPortableSelfTest.java | 47 -
...lyPortableDataStreamerMultiNodeSelfTest.java | 29 -
...rtableDataStreamerMultithreadedSelfTest.java | 47 -
...artitionedOnlyPortableMultiNodeSelfTest.java | 28 -
...tionedOnlyPortableMultithreadedSelfTest.java | 47 -
.../GridCacheMemoryModePortableSelfTest.java | 36 -
...acheOffHeapTieredAtomicPortableSelfTest.java | 47 -
...eapTieredEvictionAtomicPortableSelfTest.java | 95 -
...heOffHeapTieredEvictionPortableSelfTest.java | 95 -
.../GridCacheOffHeapTieredPortableSelfTest.java | 47 -
...ateIndexObjectPartitionedAtomicSelfTest.java | 38 -
...xObjectPartitionedTransactionalSelfTest.java | 41 -
...AtomicNearDisabledOffheapTieredSelfTest.java | 29 -
...rtableObjectsAtomicNearDisabledSelfTest.java | 51 -
...tableObjectsAtomicOffheapTieredSelfTest.java | 29 -
.../GridCachePortableObjectsAtomicSelfTest.java | 51 -
...tionedNearDisabledOffheapTieredSelfTest.java | 30 -
...eObjectsPartitionedNearDisabledSelfTest.java | 51 -
...ObjectsPartitionedOffheapTieredSelfTest.java | 30 -
...CachePortableObjectsPartitionedSelfTest.java | 51 -
...sNearPartitionedByteArrayValuesSelfTest.java | 41 -
...sPartitionedOnlyByteArrayValuesSelfTest.java | 42 -
...dCachePortableObjectsReplicatedSelfTest.java | 51 -
...CachePortableObjectsAtomicLocalSelfTest.java | 32 -
...rtableObjectsLocalOffheapTieredSelfTest.java | 29 -
.../GridCachePortableObjectsLocalSelfTest.java | 51 -
.../processors/igfs/IgfsAbstractSelfTest.java | 61 +-
.../igfs/IgfsDualAbstractSelfTest.java | 10 +-
.../processors/igfs/IgfsStartCacheTest.java | 2 +-
.../offheap/GridOffHeapMapAbstractSelfTest.java | 6 +-
...idOffHeapPartitionedMapAbstractSelfTest.java | 10 +-
.../stream/socket/SocketStreamerSelfTest.java | 27 +-
.../ignite/testframework/GridTestUtils.java | 117 +
.../ignite/testframework/junits/IgniteMock.java | 8 +-
.../multijvm/IgniteCacheProcessProxy.java | 5 -
.../junits/multijvm/IgniteProcessProxy.java | 2 +-
.../IgniteCacheFailoverTestSuite.java | 15 +-
.../IgniteCacheFailoverTestSuite3.java | 62 +
.../testsuites/IgniteCacheRestartTestSuite.java | 15 +-
.../IgniteCacheRestartTestSuite2.java | 47 +
.../IgnitePortableCacheFullApiTestSuite.java | 37 -
.../IgnitePortableCacheTestSuite.java | 103 -
.../IgnitePortableObjectsTestSuite.java | 92 -
.../ignite/portable/test1/1.1/test1-1.1.jar | Bin 2548 -> 0 bytes
.../ignite/portable/test1/1.1/test1-1.1.pom | 9 -
.../portable/test1/maven-metadata-local.xml | 12 -
.../ignite/portable/test2/1.1/test2-1.1.jar | Bin 1361 -> 0 bytes
.../ignite/portable/test2/1.1/test2-1.1.pom | 9 -
.../portable/test2/maven-metadata-local.xml | 12 -
.../hadoop/SecondaryFileSystemProvider.java | 4 +-
.../hadoop/igfs/HadoopIgfsWrapper.java | 100 +-
.../HadoopDefaultMapReducePlannerSelfTest.java | 6 +
.../testsuites/IgniteHadoopTestSuite.java | 6 +-
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 31 +-
...CacheScanPartitionQueryFallbackSelfTest.java | 105 +-
...QueryOffheapEvictsMultiThreadedSelfTest.java | 5 -
...lientQueryReplicatedNodeRestartSelfTest.java | 8 +-
.../IgniteCacheQueryNodeRestartSelfTest.java | 4 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 10 +-
.../IgniteCacheReplicatedQuerySelfTest.java | 49 +-
.../IgnitePortableCacheQueryTestSuite.java | 117 -
.../platform/PlatformContextImpl.java | 4 +-
.../platform/compute/PlatformCompute.java | 2 +-
.../cpp/PlatformCppConfigurationClosure.java | 2 +-
.../PlatformDotNetConfigurationClosure.java | 6 +-
.../platform/events/PlatformEvents.java | 2 +-
.../services/PlatformAbstractService.java | 3 +-
.../Cache/CacheAbstractTest.cs | 71 +-
.../Config/Compute/compute-grid1.xml | 8 +-
.../PlatformComputePortableArgTask.java | 8 +-
.../ignite/schema/generator/CodeGenerator.java | 4 +-
.../ignite/schema/model/PojoDescriptor.java | 6 +-
.../parser/dialect/OracleMetadataDialect.java | 7 +-
.../org/apache/ignite/IgniteSpringBean.java | 7 -
.../yardstick/config/benchmark-query.properties | 5 +-
modules/yardstick/config/ignite-base-config.xml | 2 +-
modules/yardstick/config/ignite-jdbc-config.xml | 55 +
parent/pom.xml | 10 -
pom.xml | 10 +
343 files changed, 15497 insertions(+), 18990 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/25db29bc/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/25db29bc/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 968aaf8,daf7d23..658ccef
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@@ -1271,10 -1269,6 +1270,7 @@@ public class IgniteKernal implements Ig
add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
add(ATTR_USER_NAME, System.getProperty("user.name"));
add(ATTR_GRID_NAME, gridName);
+ add(REBALANCING_VERSION, 1);
- add(ATTR_PORTABLE_PROTO_VER, cfg.getMarshaller() instanceof PortableMarshaller ?
- ((PortableMarshaller)cfg.getMarshaller()).getProtocolVersion().toString() :
- PortableMarshaller.DFLT_PORTABLE_PROTO_VER.toString());
add(ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
add(ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());
http://git-wip-us.apache.org/repos/asf/ignite/blob/25db29bc/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 94c41fd,10b8df0..cd44f23
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@@ -135,12 -135,6 +135,9 @@@ public final class IgniteNodeAttribute
/** Node consistent id. */
public static final String ATTR_NODE_CONSISTENT_ID = ATTR_PREFIX + ".consistent.id";
- /** Portable protocol version. */
- public static final String ATTR_PORTABLE_PROTO_VER = ATTR_PREFIX + ".portable.proto.ver";
-
- /** Rebalancing version id. */
++ /** Rebalancing version id. */
+ public static final String REBALANCING_VERSION = ATTR_PREFIX + ".rebalancing.version";
+
/**
* Enforces singleton.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/25db29bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/25db29bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
[19/50] [abbrv] ignite git commit: IGNITE-1402 - Fixed logging
categories
Posted by sb...@apache.org.
IGNITE-1402 - Fixed logging categories
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cc0d1f57
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cc0d1f57
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cc0d1f57
Branch: refs/heads/ignite-1093-2
Commit: cc0d1f57141d24b42c0f0ee0b7572e43aa47b339
Parents: cb9b766
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Sep 14 17:09:58 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Sep 14 17:09:58 2015 -0700
----------------------------------------------------------------------
.../org/apache/ignite/internal/GridKernalContext.java | 7 ++++---
.../org/apache/ignite/internal/GridKernalContextImpl.java | 10 +++++-----
.../java/org/apache/ignite/internal/GridLoggerProxy.java | 6 ++++--
.../java/org/apache/ignite/internal/IgniteKernal.java | 6 +++---
.../ignite/internal/executor/GridExecutorService.java | 4 ++--
.../managers/deployment/GridDeploymentStoreAdapter.java | 4 ++--
.../internal/processors/cache/GridCacheAdapter.java | 4 ++--
.../processors/cache/GridCacheClearAllRunnable.java | 4 ++--
.../ignite/internal/processors/cache/GridCacheLogger.java | 4 ++--
.../internal/processors/cache/GridCacheSharedContext.java | 4 ++--
.../datastructures/GridCacheAtomicLongImpl.java | 4 ++--
.../datastructures/GridCacheAtomicReferenceImpl.java | 4 ++--
.../datastructures/GridCacheAtomicSequenceImpl.java | 4 ++--
.../datastructures/GridCacheAtomicStampedImpl.java | 4 ++--
.../datastructures/GridCacheCountDownLatchImpl.java | 4 ++--
.../internal/processors/igfs/IgfsFragmentizerManager.java | 8 +++++---
.../internal/processors/igfs/IgfsServerManager.java | 5 +++--
.../ignite/internal/processors/job/GridJobWorker.java | 4 ++--
.../ignite/internal/processors/task/GridTaskWorker.java | 4 ++--
19 files changed, 50 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 3f73c84..c0b50a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@ -94,11 +94,12 @@ public interface GridKernalContext extends Iterable<GridComponent> {
public String gridName();
/**
- * Gets logger.
+ * Gets logger for given category.
*
+ * @param ctgr Category.
* @return Logger.
*/
- public IgniteLogger log();
+ public IgniteLogger log(String ctgr);
/**
* Gets logger for given class.
@@ -572,4 +573,4 @@ public interface GridKernalContext extends Iterable<GridComponent> {
* @return Platform processor.
*/
public PlatformProcessor platform();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 6101836..ebf83bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -754,13 +754,13 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
}
/** {@inheritDoc} */
- @Override public IgniteLogger log() {
- return config().getGridLogger();
+ @Override public IgniteLogger log(String ctgr) {
+ return config().getGridLogger().getLogger(ctgr);
}
/** {@inheritDoc} */
@Override public IgniteLogger log(Class<?> cls) {
- return config().getGridLogger().getLogger(cls);
+ return log(cls.getName());
}
/** {@inheritDoc} */
@@ -808,7 +808,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
/** {@inheritDoc} */
@Override public String userVersion(ClassLoader ldr) {
- return spring != null ? spring.userVersion(ldr, log()) : U.DFLT_USER_VERSION;
+ return spring != null ? spring.userVersion(ldr, log(spring.getClass())) : U.DFLT_USER_VERSION;
}
/** {@inheritDoc} */
@@ -967,4 +967,4 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
@Override public String toString() {
return S.toString(GridKernalContextImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
index 742552b..f6bddca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
@@ -206,7 +206,9 @@ public class GridLoggerProxy implements IgniteLogger, LifecycleAware, Externaliz
String gridNameR = t.get1();
Object ctgrR = t.get2();
- return IgnitionEx.gridx(gridNameR).log().getLogger(ctgrR);
+ IgniteLogger log = IgnitionEx.gridx(gridNameR).log();
+
+ return ctgrR != null ? log.getLogger(ctgrR) : log;
}
catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
@@ -220,4 +222,4 @@ public class GridLoggerProxy implements IgniteLogger, LifecycleAware, Externaliz
@Override public String toString() {
return S.toString(GridLoggerProxy.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index abab1f3..daf7d23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -715,8 +715,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
this.cfg = cfg;
- log = (GridLoggerProxy)cfg.getGridLogger().getLogger(getClass().getName() +
- (gridName != null ? '%' + gridName : ""));
+ log = (GridLoggerProxy)cfg.getGridLogger().getLogger(
+ getClass().getName() + (gridName != null ? '%' + gridName : ""));
RuntimeMXBean rtBean = ManagementFactory.getRuntimeMXBean();
@@ -2247,7 +2247,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
/** {@inheritDoc} */
@Override public IgniteLogger log() {
- return log;
+ return cfg.getGridLogger();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/executor/GridExecutorService.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/executor/GridExecutorService.java b/modules/core/src/main/java/org/apache/ignite/internal/executor/GridExecutorService.java
index 860504f..e8db977 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/executor/GridExecutorService.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/executor/GridExecutorService.java
@@ -135,7 +135,7 @@ public class GridExecutorService implements ExecutorService, Externalizable {
this.prj = prj;
this.ctx = ctx;
- this.log = ctx.log().getLogger(GridExecutorService.class);
+ this.log = ctx.log(GridExecutorService.class);
}
/** {@inheritDoc} */
@@ -733,4 +733,4 @@ public class GridExecutorService implements ExecutorService, Externalizable {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentStoreAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentStoreAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentStoreAdapter.java
index c2690b1..fcbc801 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentStoreAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentStoreAdapter.java
@@ -57,7 +57,7 @@ abstract class GridDeploymentStoreAdapter implements GridDeploymentStore {
this.ctx = ctx;
this.comm = comm;
- log = ctx.config().getGridLogger().getLogger(getClass());
+ log = ctx.log(getClass());
}
/**
@@ -155,4 +155,4 @@ abstract class GridDeploymentStoreAdapter implements GridDeploymentStore {
@Override public String toString() {
return S.toString(GridDeploymentStoreAdapter.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 4460a2a..9329e94 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -318,7 +318,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
this.map = map;
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
metrics = new CacheMetricsImpl(ctx);
@@ -6028,4 +6028,4 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return null;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
index e517e3a..feafc58 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
@@ -70,7 +70,7 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
this.totalCnt = totalCnt;
ctx = cache.context();
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
}
/** {@inheritDoc} */
@@ -176,4 +176,4 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
@Override public String toString() {
return S.toString(GridCacheClearAllRunnable.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLogger.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLogger.java
index f86e445..75547fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLogger.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLogger.java
@@ -72,7 +72,7 @@ class GridCacheLogger implements IgniteLogger, Externalizable {
cacheName = '<' + cctx.namexx() + "> ";
- log = cctx.kernalContext().log().getLogger(ctgr);
+ log = cctx.kernalContext().log(ctgr);
}
/**
@@ -190,4 +190,4 @@ class GridCacheLogger implements IgniteLogger, Externalizable {
@Override public String toString() {
return S.toString(GridCacheLogger.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index 90e0921..13e390a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -520,7 +520,7 @@ public class GridCacheSharedContext<K, V> {
* @return Logger.
*/
public IgniteLogger logger(String category) {
- return kernalCtx.log().getLogger(category);
+ return kernalCtx.log(category);
}
/**
@@ -685,4 +685,4 @@ public class GridCacheSharedContext<K, V> {
public void txContextReset() {
mvccMgr.contextReset();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
index 3572409..944fc5f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
@@ -223,7 +223,7 @@ public final class GridCacheAtomicLongImpl implements GridCacheAtomicLongEx, Ext
this.atomicView = atomicView;
this.name = name;
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
}
/** {@inheritDoc} */
@@ -584,4 +584,4 @@ public final class GridCacheAtomicLongImpl implements GridCacheAtomicLongEx, Ext
@Override public String toString() {
return S.toString(GridCacheAtomicLongImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
index b8794ea..b25e111 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
@@ -118,7 +118,7 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef
this.atomicView = atomicView;
this.name = name;
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
}
/** {@inheritDoc} */
@@ -371,4 +371,4 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef
@Override public String toString() {
return S.toString(GridCacheAtomicReferenceImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
index 3e1afc0..956265b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
@@ -148,7 +148,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
this.locVal = locVal;
this.name = name;
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
}
/** {@inheritDoc} */
@@ -587,4 +587,4 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
@Override public String toString() {
return S.toString(GridCacheAtomicSequenceImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
index dff32eb..f7a82a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
@@ -142,7 +142,7 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt
this.atomicView = atomicView;
this.name = name;
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
}
/** {@inheritDoc} */
@@ -411,4 +411,4 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt
@Override public String toString() {
return GridToStringBuilder.toString(GridCacheAtomicStampedImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
index cdd5f90..2667938 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
@@ -129,7 +129,7 @@ public final class GridCacheCountDownLatchImpl implements GridCacheCountDownLatc
this.latchView = latchView;
this.ctx = ctx;
- log = ctx.gridConfig().getGridLogger().getLogger(getClass());
+ log = ctx.logger(getClass());
}
/** {@inheritDoc} */
@@ -408,4 +408,4 @@ public final class GridCacheCountDownLatchImpl implements GridCacheCountDownLatc
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
index 773d758..899730d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
@@ -407,7 +407,8 @@ public class IgfsFragmentizerManager extends IgfsManager {
* Constructor.
*/
protected FragmentizerCoordinator() {
- super(igfsCtx.kernalContext().gridName(), "fragmentizer-coordinator", igfsCtx.kernalContext().log());
+ super(igfsCtx.kernalContext().gridName(), "fragmentizer-coordinator",
+ igfsCtx.kernalContext().log(IgfsFragmentizerManager.class));
igfsCtx.kernalContext().event().addLocalEventListener(this, EVT_NODE_LEFT, EVT_NODE_FAILED);
igfsCtx.kernalContext().io().addMessageListener(topic, this);
@@ -719,7 +720,8 @@ public class IgfsFragmentizerManager extends IgfsManager {
* Constructor.
*/
protected FragmentizerWorker() {
- super(igfsCtx.kernalContext().gridName(), "fragmentizer-worker", igfsCtx.kernalContext().log());
+ super(igfsCtx.kernalContext().gridName(), "fragmentizer-worker",
+ igfsCtx.kernalContext().log(IgfsFragmentizerManager.class));
}
/** {@inheritDoc} */
@@ -849,4 +851,4 @@ public class IgfsFragmentizerManager extends IgfsManager {
return this == o;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServerManager.java
index d692013..c12b367 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServerManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServerManager.java
@@ -163,7 +163,8 @@ public class IgfsServerManager extends IgfsManager {
* Constructor.
*/
private BindWorker() {
- super(igfsCtx.kernalContext().gridName(), "bind-worker", igfsCtx.kernalContext().log());
+ super(igfsCtx.kernalContext().gridName(), "bind-worker",
+ igfsCtx.kernalContext().log(IgfsServerManager.class));
}
/**
@@ -210,4 +211,4 @@ public class IgfsServerManager extends IgfsManager {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
index c243435..ae6d212 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
@@ -179,7 +179,7 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
boolean internal,
GridJobEventListener evtLsnr,
GridJobHoldListener holdLsnr) {
- super(ctx.gridName(), "grid-job-worker", ctx.log());
+ super(ctx.gridName(), "grid-job-worker", ctx.log(GridJobWorker.class));
assert ctx != null;
assert ses != null;
@@ -925,4 +925,4 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
@Override public String toString() {
return S.toString(GridJobWorker.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0d1f57/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index 8fb7e5f..26a41de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -274,7 +274,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
GridTaskEventListener evtLsnr,
@Nullable Map<GridTaskThreadContextKey, Object> thCtx,
UUID subjId) {
- super(ctx.config().getGridName(), "grid-task-worker", ctx.config().getGridLogger());
+ super(ctx.config().getGridName(), "grid-task-worker", ctx.log(GridTaskWorker.class));
assert ses != null;
assert fut != null;
@@ -1467,4 +1467,4 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
return S.toString(GridTaskWorker.class, this);
}
}
-}
\ No newline at end of file
+}
[37/50] [abbrv] ignite git commit: IGNITE-1482 - Fixed incorrect
cache value for replace() on changing topology.
Posted by sb...@apache.org.
IGNITE-1482 - Fixed incorrect cache value for replace() on changing topology.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/367d805d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/367d805d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/367d805d
Branch: refs/heads/ignite-1093-2
Commit: 367d805d10ea071532fe99c6b67cfc97cc8f2fb9
Parents: 91dd7c1
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 14:54:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 14:54:20 2015 +0300
----------------------------------------------------------------------
.../GridDistributedTxRemoteAdapter.java | 8 +--
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../IgniteCacheEntryProcessorNodeJoinTest.java | 73 ++++++++++++++++++++
3 files changed, 78 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/367d805d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index c930d88..f969737 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -521,7 +521,7 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
if (updateNearCache(cacheCtx, txEntry.key(), topVer))
nearCached = cacheCtx.dht().near().peekExx(txEntry.key());
- if (!F.isEmpty(txEntry.entryProcessors()) || !F.isEmpty(txEntry.filters()))
+ if (!F.isEmpty(txEntry.entryProcessors()))
txEntry.cached().unswap(false);
IgniteBiTuple<GridCacheOperation, CacheObject> res =
@@ -573,12 +573,12 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
// Invalidate only for near nodes (backups cannot be invalidated).
if (isSystemInvalidate() || (isInvalidate() && cacheCtx.isNear()))
cached.innerRemove(this, eventNodeId(), nodeId, false, false, true, true,
- topVer, txEntry.filters(), replicate ? DR_BACKUP : DR_NONE,
+ topVer, null, replicate ? DR_BACKUP : DR_NONE,
near() ? null : explicitVer, CU.subjectId(this, cctx),
resolveTaskName());
else {
cached.innerSet(this, eventNodeId(), nodeId, val, false, false,
- txEntry.ttl(), true, true, topVer, txEntry.filters(),
+ txEntry.ttl(), true, true, topVer, null,
replicate ? DR_BACKUP : DR_NONE, txEntry.conflictExpireTime(),
near() ? null : explicitVer, CU.subjectId(this, cctx),
resolveTaskName());
@@ -598,7 +598,7 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
}
else if (op == DELETE) {
cached.innerRemove(this, eventNodeId(), nodeId, false, false, true, true,
- topVer, txEntry.filters(), replicate ? DR_BACKUP : DR_NONE,
+ topVer, null, replicate ? DR_BACKUP : DR_NONE,
near() ? null : explicitVer, CU.subjectId(this, cctx), resolveTaskName());
// Keep near entry up to date.
http://git-wip-us.apache.org/repos/asf/ignite/blob/367d805d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 89fc0ae..81cc272 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -842,7 +842,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
IgniteTxEntry e,
Map<Integer, Collection<KeyCacheObject>> map
) {
- if (retVal || !F.isEmpty(e.entryProcessors())) {
+ if (retVal || !F.isEmpty(e.entryProcessors()) || !F.isEmpty(e.filters())) {
if (map == null)
map = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/367d805d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
index af9477e..6b4d473 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
@@ -30,7 +30,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -201,6 +203,77 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
}
}
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplaceNodeJoin() throws Exception {
+ final AtomicReference<Throwable> error = new AtomicReference<>();
+ final int started = 6;
+
+ try {
+ int keys = 100;
+
+ final AtomicBoolean done = new AtomicBoolean(false);
+
+ for (int i = 0; i < keys; i++)
+ ignite(0).cache(null).put(i, 0);
+
+ IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+ @Override public void run() {
+ try {
+ for (int i = 0; i < started; i++) {
+ U.sleep(1_000);
+
+ IgniteEx grid = startGrid(GRID_CNT + i);
+
+ info("Test started grid [idx=" + (GRID_CNT + i) + ", nodeId=" + grid.localNode().id() + ']');
+ }
+ }
+ catch (Exception e) {
+ error.compareAndSet(null, e);
+ }
+ finally {
+ done.set(true);
+ }
+ }
+ }, 1, "starter");
+
+ int updVal = 0;
+
+ try {
+ while (!done.get()) {
+ info("Will put: " + (updVal + 1));
+
+ for (int i = 0; i < keys; i++)
+ assertTrue("Failed [key=" + i + ", oldVal=" + updVal+ ']',
+ ignite(0).cache(null).replace(i, updVal, updVal + 1));
+
+ updVal++;
+ }
+ }
+ finally {
+ fut.get(getTestTimeout());
+ }
+
+ for (int i = 0; i < keys; i++) {
+ for (int g = 0; g < GRID_CNT + started; g++) {
+ Integer val = ignite(g).<Integer, Integer>cache(null).get(i);
+
+ GridCacheEntryEx entry = ((IgniteKernal)grid(g)).internalCache(null).peekEx(i);
+
+ if (updVal != val)
+ info("Invalid value for grid [g=" + g + ", entry=" + entry + ']');
+
+ assertEquals((Integer)updVal, val);
+ }
+ }
+ }
+ finally {
+ for (int i = 0; i < started; i++)
+ stopGrid(GRID_CNT + i);
+ }
+ }
+
/** */
private static class Processor implements EntryProcessor<String, Set<String>, Void>, Serializable {
/** */
[33/50] [abbrv] ignite git commit: ignite-971 Fixed offheap to swap
eviction, added failover tests with swap/offheap,
added retries for tx 'check backup' rollback.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index b401907..0c0d9c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -60,6 +60,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.failover.FailoverContext;
import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -101,6 +102,9 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
/** Backups count. */
private int backups;
+ /** */
+ private GridTestUtils.TestMemoryMode memMode = GridTestUtils.TestMemoryMode.HEAP;
+
/** Filter to include only worker nodes. */
private static final IgnitePredicate<ClusterNode> workerNodesFilter = new PN() {
@SuppressWarnings("unchecked")
@@ -202,6 +206,60 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
checkPutAllFailoverColocated(false, 5, 2);
}
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllFailoverColocatedNearEnabledTwoBackupsSwap() throws Exception {
+ memMode = GridTestUtils.TestMemoryMode.SWAP;
+
+ checkPutAllFailoverColocated(true, 5, 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllFailoverColocatedTwoBackupsSwap() throws Exception {
+ memMode = GridTestUtils.TestMemoryMode.SWAP;
+
+ checkPutAllFailoverColocated(false, 5, 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllFailoverColocatedNearEnabledTwoBackupsOffheapTiered() throws Exception {
+ memMode = GridTestUtils.TestMemoryMode.OFFHEAP_TIERED;
+
+ checkPutAllFailoverColocated(true, 5, 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllFailoverColocatedNearEnabledTwoBackupsOffheapTieredSwap() throws Exception {
+ memMode = GridTestUtils.TestMemoryMode.OFFHEAP_TIERED_SWAP;
+
+ checkPutAllFailoverColocated(true, 5, 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllFailoverColocatedNearEnabledTwoBackupsOffheapEvict() throws Exception {
+ memMode = GridTestUtils.TestMemoryMode.OFFHEAP_EVICT;
+
+ checkPutAllFailoverColocated(true, 5, 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllFailoverColocatedNearEnabledTwoBackupsOffheapEvictSwap() throws Exception {
+ memMode = GridTestUtils.TestMemoryMode.OFFHEAP_EVICT_SWAP;
+
+ checkPutAllFailoverColocated(true, 5, 2);
+ }
+
/** {@inheritDoc} */
@Override protected long getTestTimeout() {
return super.getTestTimeout() * 5;
@@ -696,6 +754,8 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
+ GridTestUtils.setMemoryMode(cfg, cacheCfg, memMode, 1000, 10 * 1024);
+
cfg.setCacheConfiguration(cacheCfg);
}
else
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index d9510e6..1fef4d5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -803,6 +803,12 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** {@inheritDoc} */
+ @Override public boolean offheapSwapEvict(byte[] vb, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
+ throws IgniteCheckedException, GridCacheEntryRemovedException {
+ return false;
+ }
+
+ /** {@inheritDoc} */
@Override public CacheObject unswap(boolean needVal) throws IgniteCheckedException {
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
index 757dce8..6f0565b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
@@ -36,11 +36,13 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteTransactions;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -110,6 +112,9 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
private int retries = DFLT_RETRIES;
/** */
+ private GridTestUtils.TestMemoryMode memMode = GridTestUtils.TestMemoryMode.HEAP;
+
+ /** */
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** {@inheritDoc} */
@@ -129,11 +134,23 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
c.setDiscoverySpi(disco);
+ CacheConfiguration ccfg = cacheConfiguration();
+
+ GridTestUtils.setMemoryMode(c, ccfg, memMode, 100, 1024);
+
+ c.setCacheConfiguration(ccfg);
+
return c;
}
+ /**
+ * @return Cache configuration.
+ */
+ protected abstract CacheConfiguration cacheConfiguration();
+
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
}
/** {@inheritDoc} */
@@ -280,7 +297,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 30000;
- checkRestartWithTx(duration, 1, 1);
+ checkRestartWithTx(duration, 1, 1, 3);
}
/**
@@ -310,7 +327,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 30000;
- checkRestartWithTx(duration, 1, 1);
+ checkRestartWithTx(duration, 1, 1, 3);
}
/**
@@ -340,7 +357,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 60000;
- checkRestartWithTx(duration, 2, 2);
+ checkRestartWithTx(duration, 2, 2, 3);
}
/**
@@ -361,6 +378,59 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
/**
* @throws Exception If failed.
*/
+ public void testRestartWithPutFourNodesOneBackupsSwap() throws Throwable {
+ restartWithPutFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.SWAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithPutFourNodesOneBackupsOffheapTiered() throws Throwable {
+ restartWithPutFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithPutFourNodesOneBackupsOffheapTieredSwap() throws Throwable {
+ restartWithPutFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_TIERED_SWAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithPutFourNodesOneBackupsOffheapEvict() throws Throwable {
+ restartWithPutFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_EVICT);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithPutFourNodesOneBackupsOffheapEvictSwap() throws Throwable {
+ restartWithPutFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_EVICT_SWAP);
+ }
+
+ /**
+ * @param memMode Memory mode.
+ * @throws Throwable If failed.
+ */
+ private void restartWithPutFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode memMode)
+ throws Throwable {
+ backups = 1;
+ nodeCnt = 4;
+ keyCnt = 100_000;
+ partitions = 29;
+ rebalancMode = ASYNC;
+ this.memMode = memMode;
+
+ long duration = 30_000;
+
+ checkRestartWithPut(duration, 2, 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testRestartWithTxFourNodesOneBackups() throws Throwable {
backups = 1;
nodeCnt = 4;
@@ -370,7 +440,59 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 60000;
- checkRestartWithTx(duration, 2, 2);
+ checkRestartWithTx(duration, 2, 2, 3);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithTxFourNodesOneBackupsSwap() throws Throwable {
+ restartWithTxFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.SWAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithTxFourNodesOneBackupsOffheapTiered() throws Throwable {
+ restartWithTxFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithTxFourNodesOneBackupsOffheapTieredSwap() throws Throwable {
+ restartWithTxFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_TIERED_SWAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithTxFourNodesOneBackupsOffheapEvict() throws Throwable {
+ restartWithTxFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_EVICT);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartWithTxFourNodesOneBackupsOffheapEvictSwap() throws Throwable {
+ restartWithTxFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode.OFFHEAP_EVICT_SWAP);
+ }
+
+ /**
+ * @param memMode Memory mode.
+ * @throws Throwable If failed.
+ */
+ private void restartWithTxFourNodesOneBackupsWithMemoryMode(GridTestUtils.TestMemoryMode memMode) throws Throwable {
+ backups = 1;
+ nodeCnt = 4;
+ keyCnt = 100_000;
+ partitions = 29;
+ rebalancMode = ASYNC;
+ this.memMode = memMode;
+
+ long duration = 30_000;
+
+ checkRestartWithTx(duration, 2, 2, 100);
}
/**
@@ -400,7 +522,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 90000;
- checkRestartWithTx(duration, 3, 3);
+ checkRestartWithTx(duration, 3, 3, 3);
}
/**
@@ -430,7 +552,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 90000;
- checkRestartWithTx(duration, 4, 4);
+ checkRestartWithTx(duration, 4, 4, 3);
}
/**
@@ -460,7 +582,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
long duration = 90000;
- checkRestartWithTx(duration, 5, 5);
+ checkRestartWithTx(duration, 5, 5, 3);
}
/**
@@ -499,7 +621,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
* @param restartThreads Restart threads count.
* @throws Exception If failed.
*/
- public void checkRestartWithPut(long duration, int putThreads, int restartThreads) throws Throwable {
+ private void checkRestartWithPut(long duration, int putThreads, int restartThreads) throws Throwable {
final long endTime = System.currentTimeMillis() + duration;
final AtomicReference<Throwable> err = new AtomicReference<>();
@@ -613,9 +735,13 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
* @param duration Test duration.
* @param putThreads Put threads count.
* @param restartThreads Restart threads count.
+ * @param txKeys Keys per transaction.
* @throws Exception If failed.
*/
- public void checkRestartWithTx(long duration, int putThreads, int restartThreads) throws Throwable {
+ private void checkRestartWithTx(long duration,
+ int putThreads,
+ int restartThreads,
+ final int txKeys) throws Throwable {
if (atomicityMode() == ATOMIC)
return;
@@ -634,8 +760,6 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
final CyclicBarrier barrier = new CyclicBarrier(putThreads + restartThreads);
- final int txKeys = 3;
-
for (int i = 0; i < putThreads; i++) {
final int gridIdx = i;
@@ -699,6 +823,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
if (c % logFreq == 0) {
info(">>> Tx iteration finished [cnt=" + c +
+ ", cacheSize=" + cache.localSize() +
", keys=" + keys +
", locNodeId=" + locNodeId + ']');
}
@@ -773,7 +898,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
* @param restartThreads Restart threads count.
* @throws Exception If failed.
*/
- public void checkRestartWithTxPutAll(long duration, int putThreads, int restartThreads) throws Throwable {
+ private void checkRestartWithTxPutAll(long duration, int putThreads, int restartThreads) throws Throwable {
if (atomicityMode() == ATOMIC)
return;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
index b7f52ba..bee94a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
@@ -17,11 +17,13 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -40,12 +42,12 @@ public class GridCacheDhtAtomicRemoveFailureTest extends GridCacheAbstractRemove
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setNearConfiguration(null);
- cfg.setBackups(1);
+ @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ return CLOCK;
+ }
- return cfg;
+ /** {@inheritDoc} */
+ @Override protected NearCacheConfiguration nearCache() {
+ return null;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtRemoveFailureTest.java
index 1c351ff..a13ba30 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtRemoveFailureTest.java
@@ -17,10 +17,12 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
/**
@@ -33,12 +35,12 @@ public class GridCacheDhtRemoveFailureTest extends GridCacheAbstractRemoveFailur
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setNearConfiguration(null);
- cfg.setBackups(1);
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return TRANSACTIONAL;
+ }
- return cfg;
+ /** {@inheritDoc} */
+ @Override protected NearCacheConfiguration nearCache() {
+ return null;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
index dc78003..4302486 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -199,7 +199,7 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
try {
final Ignite ignite = ignite(0);
- final IgniteCache<Object, Object> cache = ignite.cache(null);
+ final IgniteCache<Object, Object> cache = ignite.cache(null).withNoRetries();
final int key = generateKey(ignite, backup);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
index 4c52e6f..7425e23 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
@@ -40,7 +40,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -51,6 +51,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.testframework.GridTestUtils.TestMemoryMode;
+import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync;
+import static org.apache.ignite.testframework.GridTestUtils.setMemoryMode;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
@@ -86,6 +89,8 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
if (gridName.equals(getTestGridName(GRID_CNT - 1)))
cfg.setClientMode(true);
+ cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+
return cfg;
}
@@ -107,9 +112,13 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
* @param name Cache name.
* @param cacheMode Cache mode.
* @param parts Number of partitions.
+ * @param memMode Memory mode.
* @return Cache configuration.
*/
- private CacheConfiguration cacheConfiguration(String name, CacheMode cacheMode, int parts) {
+ private CacheConfiguration cacheConfiguration(String name,
+ CacheMode cacheMode,
+ int parts,
+ TestMemoryMode memMode) {
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setName(name);
@@ -122,6 +131,8 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
ccfg.setAffinity(new RendezvousAffinityFunction(false, parts));
+ setMemoryMode(null, ccfg, memMode, 100, 1024);
+
return ccfg;
}
@@ -134,49 +145,63 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
* @throws Exception If failed.
*/
public void testCrossCachePessimisticTxFailover() throws Exception {
- crossCacheTxFailover(PARTITIONED, true, PESSIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(PARTITIONED, true, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCrossCachePessimisticTxFailoverOffheapSwap() throws Exception {
+ crossCacheTxFailover(PARTITIONED, true, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.OFFHEAP_EVICT_SWAP);
}
/**
* @throws Exception If failed.
*/
public void testCrossCachePessimisticTxFailoverDifferentAffinity() throws Exception {
- crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testCrossCacheOptimisticTxFailover() throws Exception {
- crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCrossCacheOptimisticTxFailoverOffheapSwap() throws Exception {
+ crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.OFFHEAP_EVICT_SWAP);
}
/**
* @throws Exception If failed.
*/
public void testCrossCacheOptimisticTxFailoverDifferentAffinity() throws Exception {
- crossCacheTxFailover(PARTITIONED, false, OPTIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(PARTITIONED, false, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testCrossCachePessimisticTxFailoverReplicated() throws Exception {
- crossCacheTxFailover(REPLICATED, true, PESSIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(REPLICATED, true, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testCrossCacheOptimisticTxFailoverReplicated() throws Exception {
- crossCacheTxFailover(REPLICATED, true, OPTIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(REPLICATED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testCrossCachePessimisticTxFailoverDifferentAffinityReplicated() throws Exception {
- crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ);
+ crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP);
}
/**
@@ -184,23 +209,25 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
* @param sameAff If {@code false} uses different number of partitions for caches.
* @param concurrency Transaction concurrency.
* @param isolation Transaction isolation.
+ * @param memMode Memory mode.
* @throws Exception If failed.
*/
private void crossCacheTxFailover(CacheMode cacheMode,
boolean sameAff,
final TransactionConcurrency concurrency,
- final TransactionIsolation isolation) throws Exception {
+ final TransactionIsolation isolation,
+ TestMemoryMode memMode) throws Exception {
IgniteKernal ignite0 = (IgniteKernal)ignite(0);
final AtomicBoolean stop = new AtomicBoolean();
try {
- ignite0.createCache(cacheConfiguration(CACHE1, cacheMode, 256));
- ignite0.createCache(cacheConfiguration(CACHE2, cacheMode, sameAff ? 256 : 128));
+ ignite0.createCache(cacheConfiguration(CACHE1, cacheMode, 256, memMode));
+ ignite0.createCache(cacheConfiguration(CACHE2, cacheMode, sameAff ? 256 : 128, memMode));
final AtomicInteger threadIdx = new AtomicInteger();
- IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ IgniteInternalFuture<?> fut = runMultiThreadedAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
int idx = threadIdx.getAndIncrement();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index 8a72bb9..943caeb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -24,35 +24,54 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import javax.cache.configuration.Factory;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cache.CachePartialUpdateException;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.testframework.GridTestUtils.TestMemoryMode;
+import static org.apache.ignite.testframework.GridTestUtils.runAsync;
/**
*
*/
-public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 4;
- }
+public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final long DURATION = 60_000;
+
+ /** */
+ protected static final int GRID_CNT = 4;
/**
* @return Keys count for the test.
@@ -61,14 +80,29 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
return 10_000;
}
- /** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
+ /**
+ * @param memMode Memory mode.
+ * @param store If {@code true} adds cache store.
+ * @return Cache configuration.
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("unchecked")
+ protected CacheConfiguration cacheConfiguration(TestMemoryMode memMode, boolean store) throws Exception {
+ CacheConfiguration cfg = new CacheConfiguration();
+ cfg.setAtomicityMode(atomicityMode());
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setAtomicWriteOrderMode(writeOrderMode());
cfg.setBackups(1);
cfg.setRebalanceMode(SYNC);
+ if (store) {
+ cfg.setCacheStoreFactory(new TestStoreFactory());
+ cfg.setWriteThrough(true);
+ }
+
+ GridTestUtils.setMemoryMode(null, cfg, memMode, 100, 1024);
+
return cfg;
}
@@ -76,15 +110,47 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
AtomicConfiguration acfg = new AtomicConfiguration();
acfg.setBackups(1);
cfg.setAtomicConfiguration(acfg);
+ cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(GRID_CNT);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ ignite(0).destroyCache(null);
+ }
+
+ /**
+ * @return Cache atomicity mode.
+ */
+ protected abstract CacheAtomicityMode atomicityMode();
+
/**
* @return Write order mode.
*/
@@ -96,47 +162,79 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
* @throws Exception If failed.
*/
public void testPut() throws Exception {
- checkRetry(Test.PUT);
+ checkRetry(Test.PUT, TestMemoryMode.HEAP, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutStoreEnabled() throws Exception {
+ checkRetry(Test.PUT, TestMemoryMode.HEAP, true);
}
/**
* @throws Exception If failed.
*/
public void testPutAll() throws Exception {
- checkRetry(Test.PUT_ALL);
+ checkRetry(Test.PUT_ALL, TestMemoryMode.HEAP, false);
}
/**
* @throws Exception If failed.
*/
public void testPutAsync() throws Exception {
- checkRetry(Test.PUT_ASYNC);
+ checkRetry(Test.PUT_ASYNC, TestMemoryMode.HEAP, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAsyncStoreEnabled() throws Exception {
+ checkRetry(Test.PUT_ASYNC, TestMemoryMode.HEAP, true);
}
/**
* @throws Exception If failed.
*/
public void testInvoke() throws Exception {
- checkRetry(Test.INVOKE);
+ checkRetry(Test.INVOKE, TestMemoryMode.HEAP, false);
}
/**
* @throws Exception If failed.
*/
public void testInvokeAll() throws Exception {
- checkRetry(Test.INVOKE_ALL);
+ checkRetry(Test.INVOKE_ALL, TestMemoryMode.HEAP, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeAllOffheapSwap() throws Exception {
+ checkRetry(Test.INVOKE_ALL, TestMemoryMode.OFFHEAP_EVICT_SWAP, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeAllOffheapTiered() throws Exception {
+ checkRetry(Test.INVOKE_ALL, TestMemoryMode.OFFHEAP_TIERED, false);
}
/**
* @param test Test type.
+ * @param memMode Memory mode.
+ * @param store If {@code true} uses cache with store.
* @throws Exception If failed.
*/
- private void checkRetry(Test test) throws Exception {
+ private void checkRetry(Test test, TestMemoryMode memMode, boolean store) throws Exception {
+ ignite(0).createCache(cacheConfiguration(memMode, store));
+
final AtomicBoolean finished = new AtomicBoolean();
int keysCnt = keysCount();
- IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
+ IgniteInternalFuture<Object> fut = runAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
while (!finished.get()) {
stopGrid(3);
@@ -155,10 +253,12 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
int iter = 0;
try {
- if (atomicityMode() == ATOMIC)
- assertEquals(writeOrderMode(), cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
+ if (atomicityMode() == ATOMIC) {
+ assertEquals(writeOrderMode(),
+ cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
+ }
- long stopTime = System.currentTimeMillis() + 60_000;
+ long stopTime = System.currentTimeMillis() + DURATION;
switch (test) {
case PUT: {
@@ -288,7 +388,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
for (int i = 0; i < keysCnt; i++)
assertEquals((Integer)iter, cache.get(i));
- for (int i = 0; i < gridCount(); i++) {
+ for (int i = 0; i < GRID_CNT; i++) {
IgniteKernal ignite = (IgniteKernal)grid(i);
Collection<?> futs = ignite.context().cache().context().mvcc().atomicFutures();
@@ -316,9 +416,11 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
* @throws Exception If failed.
*/
private void checkFailsWithNoRetries(boolean async) throws Exception {
+ ignite(0).createCache(cacheConfiguration(TestMemoryMode.HEAP, false));
+
final AtomicBoolean finished = new AtomicBoolean();
- IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
+ IgniteInternalFuture<Object> fut = runAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
while (!finished.get()) {
stopGrid(3);
@@ -428,4 +530,26 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
return old == null ? 0 : old;
}
}
+
+ /**
+ *
+ */
+ private static class TestStoreFactory implements Factory<CacheStore> {
+ /** {@inheritDoc} */
+ @Override public CacheStore create() {
+ return new CacheStoreAdapter() {
+ @Override public Object load(Object key) throws CacheLoaderException {
+ return null;
+ }
+
+ @Override public void write(Cache.Entry entry) throws CacheWriterException {
+ // No-op.
+ }
+
+ @Override public void delete(Object key) throws CacheWriterException {
+ // No-op.
+ }
+ };
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
index 9d84609..3d7c7d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
@@ -47,6 +47,8 @@ public class IgniteCachePutRetryAtomicSelfTest extends IgniteCachePutRetryAbstra
* @throws Exception If failed.
*/
public void testPutInsideTransaction() throws Exception {
+ ignite(0).createCache(cacheConfiguration(GridTestUtils.TestMemoryMode.HEAP, false));
+
CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
ccfg.setName("tx-cache");
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
index 7c66efc..f61faf2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
@@ -31,12 +31,13 @@ import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheEntryProcessor;
-import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.GridTestUtils;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.testframework.GridTestUtils.TestMemoryMode;
+import static org.apache.ignite.testframework.GridTestUtils.runAsync;
+import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync;
/**
*
@@ -50,11 +51,6 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
return TRANSACTIONAL;
}
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
/**
* @throws Exception If failed.
*/
@@ -63,7 +59,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
IgniteAtomicLong atomic = ignite(0).atomicLong("TestAtomic", 0, true);
- IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
+ IgniteInternalFuture<Object> fut = runAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
while (!finished.get()) {
stopGrid(3);
@@ -92,15 +88,42 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
}
}
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
+ /**
+ * @throws Exception If failed.
+ */
public void testExplicitTransactionRetries() throws Exception {
+ explicitTransactionRetries(TestMemoryMode.HEAP, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testExplicitTransactionRetriesStoreEnabled() throws Exception {
+ explicitTransactionRetries(TestMemoryMode.HEAP, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testExplicitTransactionRetriesOffheapSwap() throws Exception {
+ explicitTransactionRetries(TestMemoryMode.OFFHEAP_EVICT_SWAP, false);
+ }
+
+ /**
+ * @param memMode Memory mode.
+ * @param store If {@code true} uses cache with store.
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("unchecked")
+ public void explicitTransactionRetries(TestMemoryMode memMode, boolean store) throws Exception {
+ ignite(0).createCache(cacheConfiguration(memMode, store));
+
final AtomicInteger idx = new AtomicInteger();
int threads = 8;
final AtomicReferenceArray<Exception> err = new AtomicReferenceArray<>(threads);
- IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ IgniteInternalFuture<Long> fut = runMultiThreadedAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
int th = idx.getAndIncrement();
int base = th * FACTOR;
@@ -115,8 +138,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
if (i > 0 && i % 500 == 0)
info("Done: " + i);
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
err.set(th, e);
}
@@ -142,7 +164,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
}
// Verify contents of the cache.
- for (int g = 0; g < gridCount(); g++) {
+ for (int g = 0; g < GRID_CNT; g++) {
IgniteCache<Object, Object> cache = ignite(g).cache(null);
for (int th = 0; th < threads; th++) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index c598e97..3913957 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -65,6 +66,7 @@ import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
+import static org.apache.ignite.testframework.GridTestUtils.TestMemoryMode;
/**
* Test GridDhtInvalidPartitionException handling in ATOMIC cache during restarts.
@@ -83,19 +85,26 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
/** Write sync. */
private CacheWriteSynchronizationMode writeSync;
+ /** Memory mode. */
+ private TestMemoryMode memMode;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER).setForceServerMode(true));
- cfg.setCacheConfiguration(cacheConfiguration());
+ CacheConfiguration ccfg = cacheConfiguration();
+
+ cfg.setCacheConfiguration(ccfg);
cfg.setCommunicationSpi(new DelayCommunicationSpi());
if (testClientNode() && getTestGridName(0).equals(gridName))
cfg.setClientMode(true);
+ GridTestUtils.setMemoryMode(cfg, ccfg, memMode, 100, 1024);
+
return cfg;
}
@@ -137,53 +146,99 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
* @throws Exception If failed.
*/
public void testClockFullSync() throws Exception {
- checkRestarts(CLOCK, FULL_SYNC);
+ checkRestarts(CLOCK, FULL_SYNC, TestMemoryMode.HEAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClockFullSyncSwap() throws Exception {
+ checkRestarts(CLOCK, FULL_SYNC, TestMemoryMode.SWAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClockFullSyncOffheapTiered() throws Exception {
+ checkRestarts(CLOCK, FULL_SYNC, TestMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClockFullSyncOffheapSwap() throws Exception {
+ checkRestarts(CLOCK, FULL_SYNC, TestMemoryMode.OFFHEAP_EVICT_SWAP);
}
/**
* @throws Exception If failed.
*/
public void testClockPrimarySync() throws Exception {
- checkRestarts(CLOCK, PRIMARY_SYNC);
+ checkRestarts(CLOCK, PRIMARY_SYNC, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testClockFullAsync() throws Exception {
- checkRestarts(CLOCK, FULL_ASYNC);
+ checkRestarts(CLOCK, FULL_ASYNC, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testPrimaryFullSync() throws Exception {
- checkRestarts(PRIMARY, FULL_SYNC);
+ checkRestarts(PRIMARY, FULL_SYNC, TestMemoryMode.HEAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPrimaryFullSyncSwap() throws Exception {
+ checkRestarts(PRIMARY, FULL_SYNC, TestMemoryMode.SWAP);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPrimaryFullSyncOffheapTiered() throws Exception {
+ checkRestarts(PRIMARY, FULL_SYNC, TestMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPrimaryFullSyncOffheapSwap() throws Exception {
+ checkRestarts(PRIMARY, FULL_SYNC, TestMemoryMode.OFFHEAP_EVICT_SWAP);
}
/**
* @throws Exception If failed.
*/
public void testPrimaryPrimarySync() throws Exception {
- checkRestarts(PRIMARY, PRIMARY_SYNC);
+ checkRestarts(PRIMARY, PRIMARY_SYNC, TestMemoryMode.HEAP);
}
/**
* @throws Exception If failed.
*/
public void testPrimaryFullAsync() throws Exception {
- checkRestarts(PRIMARY, FULL_ASYNC);
+ checkRestarts(PRIMARY, FULL_ASYNC, TestMemoryMode.HEAP);
}
/**
* @param writeOrder Write order to check.
* @param writeSync Write synchronization mode to check.
+ * @param memMode Memory mode.
* @throws Exception If failed.
*/
- private void checkRestarts(CacheAtomicWriteOrderMode writeOrder, CacheWriteSynchronizationMode writeSync)
+ private void checkRestarts(CacheAtomicWriteOrderMode writeOrder,
+ CacheWriteSynchronizationMode writeSync,
+ TestMemoryMode memMode)
throws Exception {
this.writeOrder = writeOrder;
this.writeSync = writeSync;
+ this.memMode = memMode;
final int gridCnt = 6;
@@ -227,16 +282,16 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
for (int i = 0; i < gridCnt; i++) {
ClusterNode locNode = grid(i).localNode();
- GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache();
+ IgniteCache<Object, Object> cache = grid(i).cache(null);
- GridCacheEntryEx entry = c.peekEx(key);
+ Object val = cache.localPeek(key);
if (affNodes.contains(locNode)) {
- if (entry == null)
+ if (val == null)
return false;
}
else
- assertNull(entry);
+ assertNull(val);
}
it.remove();
@@ -323,7 +378,20 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache();
- GridCacheEntryEx entry = c.peekEx(k);
+ GridCacheEntryEx entry = null;
+
+ if (memMode == TestMemoryMode.HEAP)
+ entry = c.peekEx(k);
+ else {
+ try {
+ entry = c.entryEx(k);
+
+ entry.unswap();
+ }
+ catch (GridDhtInvalidPartitionException e) {
+ // Skip key.
+ }
+ }
for (int r = 0; r < 10; r++) {
try {
@@ -383,7 +451,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
*/
private static class DelayCommunicationSpi extends TcpCommunicationSpi {
/** {@inheritDoc} */
- @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure)
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
throws IgniteSpiException {
try {
if (delayMessage((GridIoMessage)msg))
@@ -393,7 +461,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
throw new IgniteSpiException(e);
}
- super.sendMessage(node, msg, ackClosure);
+ super.sendMessage(node, msg, ackC);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
index 844bde3..2fd8a82 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
@@ -17,9 +17,9 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
@@ -42,17 +42,12 @@ public class GridCacheAtomicPrimaryWriteOrderRemoveFailureTest extends GridCache
}
/** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
+ @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ return PRIMARY;
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setBackups(1);
- cfg.setAtomicWriteOrderMode(PRIMARY);
-
- return cfg;
+ @Override protected NearCacheConfiguration nearCache() {
+ return null;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
index 9966e18..a21cd35 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
@@ -17,9 +17,9 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
@@ -42,17 +42,12 @@ public class GridCacheAtomicRemoveFailureTest extends GridCacheAbstractRemoveFai
}
/** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
+ @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ return CLOCK;
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setBackups(1);
- cfg.setAtomicWriteOrderMode(CLOCK);
-
- return cfg;
+ @Override protected NearCacheConfiguration nearCache() {
+ return null;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
index a6fc2b9..d9c6e01 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
@@ -17,9 +17,9 @@
package org.apache.ignite.internal.processors.cache.distributed.near;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
@@ -41,13 +41,12 @@ public class GridCacheAtomicNearRemoveFailureTest extends GridCacheAbstractRemov
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setNearConfiguration(new NearCacheConfiguration());
- cfg.setBackups(1);
- cfg.setAtomicWriteOrderMode(CLOCK);
+ @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ return CLOCK;
+ }
- return cfg;
+ /** {@inheritDoc} */
+ @Override protected NearCacheConfiguration nearCache() {
+ return new NearCacheConfiguration();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
index 6362bc8..f6e7e2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
@@ -17,9 +17,9 @@
package org.apache.ignite.internal.processors.cache.distributed.near;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
@@ -41,13 +41,12 @@ public class GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest extends GridC
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setNearConfiguration(new NearCacheConfiguration());
- cfg.setBackups(1);
- cfg.setAtomicWriteOrderMode(PRIMARY);
+ @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ return PRIMARY;
+ }
- return cfg;
+ /** {@inheritDoc} */
+ @Override protected NearCacheConfiguration nearCache() {
+ return new NearCacheConfiguration();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearRemoveFailureTest.java
index 1cf3da1..a7e8eb9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearRemoveFailureTest.java
@@ -17,11 +17,12 @@
package org.apache.ignite.internal.processors.cache.distributed.near;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
/**
@@ -34,12 +35,12 @@ public class GridCacheNearRemoveFailureTest extends GridCacheAbstractRemoveFailu
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
- CacheConfiguration cfg = super.cacheConfiguration(gridName);
-
- cfg.setNearConfiguration(new NearCacheConfiguration());
- cfg.setBackups(1);
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return TRANSACTIONAL;
+ }
- return cfg;
+ /** {@inheritDoc} */
+ @Override protected NearCacheConfiguration nearCache() {
+ return new NearCacheConfiguration();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
index 265c185..684d6e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
@@ -36,6 +36,11 @@ public class GridCachePartitionedNodeRestartTest extends GridCacheAbstractNodeRe
c.getTransactionConfiguration().setDefaultTxConcurrency(PESSIMISTIC);
+ return c;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheConfiguration cacheConfiguration() {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setName(CACHE_NAME);
@@ -49,9 +54,7 @@ public class GridCachePartitionedNodeRestartTest extends GridCacheAbstractNodeRe
cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
cc.setBackups(backups);
- c.setCacheConfiguration(cc);
-
- return c;
+ return cc;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
index 0e81828..a458aa7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
@@ -44,6 +44,11 @@ public class GridCachePartitionedOptimisticTxNodeRestartTest extends GridCacheAb
c.getTransactionConfiguration().setDefaultTxConcurrency(OPTIMISTIC);
+ return c;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheConfiguration cacheConfiguration() {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setName(CACHE_NAME);
@@ -57,9 +62,7 @@ public class GridCachePartitionedOptimisticTxNodeRestartTest extends GridCacheAb
cc.setNearConfiguration(nearEnabled() ? new NearCacheConfiguration() : null);
- c.setCacheConfiguration(cc);
-
- return c;
+ return cc;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
index 5be228d..7e3e7e5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
@@ -30,9 +30,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
*/
public class GridCacheReplicatedNodeRestartSelfTest extends GridCacheAbstractNodeRestartSelfTest {
/** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(gridName);
-
+ @Override protected CacheConfiguration cacheConfiguration() {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setNearConfiguration(null);
@@ -51,9 +49,7 @@ public class GridCacheReplicatedNodeRestartSelfTest extends GridCacheAbstractNod
cc.setRebalanceBatchSize(20);
- c.setCacheConfiguration(cc);
-
- return c;
+ return cc;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
index 4bda4f4..4cda0c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java
@@ -42,7 +42,7 @@ public abstract class GridOffHeapMapAbstractSelfTest extends GridCommonAbstractT
private static final Random RAND = new Random();
/** Unsafe map. */
- private GridOffHeapMap<String> map;
+ private GridOffHeapMap map;
/** */
protected float load = 0.75f;
@@ -86,7 +86,7 @@ public abstract class GridOffHeapMapAbstractSelfTest extends GridCommonAbstractT
/**
* @return New map.
*/
- protected abstract <K> GridOffHeapMap<K> newMap();
+ protected abstract GridOffHeapMap newMap();
/**
*
@@ -551,6 +551,10 @@ public abstract class GridOffHeapMapAbstractSelfTest extends GridCommonAbstractT
evictCnt.incrementAndGet();
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
@@ -587,6 +591,10 @@ public abstract class GridOffHeapMapAbstractSelfTest extends GridCommonAbstractT
@Override public void onEvict(int part, int hash, byte[] k, byte[] v) {
evictCnt.incrementAndGet();
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
@@ -622,6 +630,10 @@ public abstract class GridOffHeapMapAbstractSelfTest extends GridCommonAbstractT
@Override public void onEvict(int part, int hash, byte[] k, byte[] v) {
evictCnt.incrementAndGet();
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java
index d1a1b20..f7388e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java
@@ -39,7 +39,7 @@ public abstract class GridOffHeapMapPerformanceAbstractTest extends GridCommonAb
new HashMap<>(LOAD_CNT);
/** Unsafe map. */
- private GridOffHeapMap<String> map;
+ private GridOffHeapMap map;
/** */
protected float load = 0.75f;
@@ -91,7 +91,7 @@ public abstract class GridOffHeapMapPerformanceAbstractTest extends GridCommonAb
/**
* @return New map.
*/
- protected abstract <K> GridOffHeapMap<K> newMap();
+ protected abstract GridOffHeapMap newMap();
/**
* @param key Key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
index 03fcd4a..c40c10f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
@@ -882,6 +882,10 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends GridComm
evictCnt.incrementAndGet();
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
@@ -921,6 +925,10 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends GridComm
@Override public void onEvict(int part, int hash, byte[] k, byte[] v) {
evictCnt.incrementAndGet();
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
@@ -957,6 +965,10 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends GridComm
@Override public void onEvict(int part, int hash, byte[] k, byte[] v) {
evictCnt.incrementAndGet();
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
@@ -1009,6 +1021,10 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends GridComm
evicted.set(key);
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
@@ -1072,6 +1088,10 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends GridComm
evicted.set(key);
}
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
};
map = newMap();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapPerformanceTest.java
index e758246..58ad494 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapPerformanceTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.util.offheap.GridOffHeapMapPerformanceAbstract
*/
public class GridUnsafeMapPerformanceTest extends GridOffHeapMapPerformanceAbstractTest {
/** {@inheritDoc} */
- @Override protected <K> GridOffHeapMap<K> newMap() {
+ @Override protected GridOffHeapMap newMap() {
return GridOffHeapMapFactory.unsafeMap(concurrency, load, initCap, mem, lruStripes, evictClo);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapSelfTest.java
index 43fdb34..0e36f3d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMapSelfTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.util.offheap.GridOffHeapMapFactory;
*/
public class GridUnsafeMapSelfTest extends GridOffHeapMapAbstractSelfTest {
/** {@inheritDoc} */
- @Override protected <K> GridOffHeapMap<K> newMap() {
+ @Override protected GridOffHeapMap newMap() {
return GridOffHeapMapFactory.unsafeMap(concurrency, load, initCap, mem, lruStripes, evictLsnr);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/GridOffHeapMapPerformanceAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/GridOffHeapMapPerformanceAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/GridOffHeapMapPerformanceAbstractTest.java
index ed37306..4064482 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/GridOffHeapMapPerformanceAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/GridOffHeapMapPerformanceAbstractTest.java
@@ -42,7 +42,7 @@ public abstract class GridOffHeapMapPerformanceAbstractTest extends GridCommonAb
new HashMap<>(LOAD_CNT);
/** Unsafe map. */
- private GridOffHeapMap<String> map;
+ private GridOffHeapMap map;
/** */
protected float load = 0.75f;
@@ -94,7 +94,7 @@ public abstract class GridOffHeapMapPerformanceAbstractTest extends GridCommonAb
/**
* @return New map.
*/
- protected abstract <K> GridOffHeapMap<K> newMap();
+ protected abstract GridOffHeapMap newMap();
/**
* @param key Key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/unsafe/GridUnsafeMapPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/unsafe/GridUnsafeMapPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/unsafe/GridUnsafeMapPerformanceTest.java
index 1486a9c..af691b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/unsafe/GridUnsafeMapPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/offheap/unsafe/GridUnsafeMapPerformanceTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.util.offheap.GridOffHeapMapPerformanceAbstract
*/
public class GridUnsafeMapPerformanceTest extends GridOffHeapMapPerformanceAbstractTest {
/** {@inheritDoc} */
- @Override protected <K> GridOffHeapMap<K> newMap() {
+ @Override protected GridOffHeapMap newMap() {
return GridOffHeapMapFactory.unsafeMap(concurrency, load, initCap, mem, lruStripes, evictClo);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index b585a8f..edf7c52 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -59,7 +59,11 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -83,6 +87,7 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
import org.apache.ignite.ssl.SslContextFactory;
import org.apache.ignite.testframework.config.GridTestProperties;
import org.jetbrains.annotations.NotNull;
@@ -1582,4 +1587,116 @@ public final class GridTestUtils {
suite.addTestSuite(test);
}
+
+ /**
+ * Sets cache configuration parameters according to test memory mode.
+ *
+ * @param cfg Ignite configuration.
+ * @param ccfg Cache configuration.
+ * @param testMode Test memory mode.
+ * @param maxHeapCnt Maximum number of entries in heap (used if test mode involves eviction from heap).
+ * @param maxOffheapSize Maximum offheap memory size (used if test mode involves eviction from offheap to swap).
+ */
+ public static void setMemoryMode(IgniteConfiguration cfg, CacheConfiguration ccfg,
+ TestMemoryMode testMode,
+ int maxHeapCnt,
+ long maxOffheapSize) {
+ assert testMode != null;
+ assert ccfg != null;
+
+ CacheMemoryMode memMode;
+ boolean swap = false;
+ boolean evictionPlc = false;
+ long offheapMaxMem = -1L;
+
+ switch (testMode) {
+ case HEAP: {
+ memMode = CacheMemoryMode.ONHEAP_TIERED;
+ swap = false;
+
+ break;
+ }
+
+ case SWAP: {
+ memMode = CacheMemoryMode.ONHEAP_TIERED;
+ evictionPlc = true;
+ swap = true;
+
+ break;
+ }
+
+ case OFFHEAP_TIERED: {
+ memMode = CacheMemoryMode.OFFHEAP_TIERED;
+ offheapMaxMem = 0;
+
+ break;
+ }
+
+ case OFFHEAP_TIERED_SWAP: {
+ assert maxOffheapSize > 0 : maxOffheapSize;
+
+ memMode = CacheMemoryMode.OFFHEAP_TIERED;
+ offheapMaxMem = maxOffheapSize;
+ swap = true;
+
+ break;
+ }
+
+ case OFFHEAP_EVICT: {
+ memMode = CacheMemoryMode.ONHEAP_TIERED;
+ evictionPlc = true;
+ offheapMaxMem = 0;
+
+ break;
+ }
+
+ case OFFHEAP_EVICT_SWAP: {
+ assert maxOffheapSize > 0 : maxOffheapSize;
+
+ memMode = CacheMemoryMode.ONHEAP_TIERED;
+ swap = true;
+ evictionPlc = true;
+ offheapMaxMem = maxOffheapSize;
+
+ break;
+ }
+
+ default:
+ throw new IllegalArgumentException("Invalid mode: " + testMode);
+ }
+
+ ccfg.setMemoryMode(memMode);
+ ccfg.setSwapEnabled(swap);
+
+ if (swap && cfg != null)
+ cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+
+ if (evictionPlc) {
+ LruEvictionPolicy plc = new LruEvictionPolicy();
+
+ plc.setMaxSize(maxHeapCnt);
+
+ ccfg.setEvictionPolicy(plc);
+ }
+
+ ccfg.setOffHeapMaxMemory(offheapMaxMem);
+ }
+
+ /**
+ *
+ */
+ public enum TestMemoryMode {
+ /** Heap only. */
+ HEAP,
+ /** Evict from heap to swap with eviction policy. */
+ SWAP,
+ /** Always evict to offheap, no swap. */
+ OFFHEAP_TIERED,
+ /** Always evict to offheap + evict from offheap to swap when max offheap memory limit is reached. */
+ OFFHEAP_TIERED_SWAP,
+ /** Evict to offheap with eviction policy, no swap. */
+ OFFHEAP_EVICT,
+ /** Evict to offheap with eviction policy + evict from offheap to swap when max offheap memory limit is reached. */
+ OFFHEAP_EVICT_SWAP,
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index eaeb7b3..abc8765 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -91,12 +91,6 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
suite.addTestSuite(IgniteCacheTxNearDisabledPutGetRestartTest.class);
suite.addTestSuite(IgniteCacheTxNearDisabledFairAffinityPutGetRestartTest.class);
- suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
- suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class);
- suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
-
- suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
-
suite.addTestSuite(IgniteCacheSizeFailoverTest.class);
suite.addTestSuite(IgniteCacheTopologySafeGetSelfTest.class);
[34/50] [abbrv] ignite git commit: ignite-971 Fixed offheap to swap
eviction, added failover tests with swap/offheap,
added retries for tx 'check backup' rollback.
Posted by sb...@apache.org.
ignite-971 Fixed offheap to swap eviction, added failover tests with swap/offheap, added retries for tx 'check backup' rollback.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a7490a6e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a7490a6e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a7490a6e
Branch: refs/heads/ignite-1093-2
Commit: a7490a6e48d4c9f1e85a3ae08f97d6c5ced7a71b
Parents: eb7d2b0
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 12:46:48 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 12:46:48 2015 +0300
----------------------------------------------------------------------
.../processors/cache/CacheMetricsImpl.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 21 +-
.../processors/cache/GridCacheEntryEx.java | 13 ++
.../cache/GridCacheEvictionManager.java | 18 +-
.../processors/cache/GridCacheMapEntry.java | 52 ++++-
.../cache/GridCacheSwapEntryImpl.java | 24 +--
.../processors/cache/GridCacheSwapManager.java | 190 +++++++++++++++---
.../processors/cache/GridCacheUtils.java | 21 +-
.../distributed/dht/GridDhtLocalPartition.java | 7 +-
.../dht/GridDhtPartitionTopologyImpl.java | 9 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 3 +
.../near/GridNearTxFinishFuture.java | 32 ++-
.../cache/transactions/IgniteTxHandler.java | 9 +-
.../offheap/GridOffHeapProcessor.java | 25 ++-
.../util/offheap/GridOffHeapEvictListener.java | 5 +
.../internal/util/offheap/GridOffHeapMap.java | 13 +-
.../util/offheap/GridOffHeapMapFactory.java | 28 +--
.../util/offheap/GridOffHeapPartitionedMap.java | 12 ++
.../util/offheap/unsafe/GridUnsafeMap.java | 128 ++++++++----
.../unsafe/GridUnsafePartitionedMap.java | 9 +
.../cache/CacheSwapUnswapGetTest.java | 85 +++++++-
.../cache/GridCacheAbstractFullApiSelfTest.java | 7 +-
.../GridCacheAbstractRemoveFailureTest.java | 199 +++++++++++++------
.../cache/GridCacheMemoryModeSelfTest.java | 9 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 60 ++++++
.../processors/cache/GridCacheTestEntryEx.java | 6 +
.../GridCacheAbstractNodeRestartSelfTest.java | 149 ++++++++++++--
.../GridCacheDhtAtomicRemoveFailureTest.java | 16 +-
.../dht/GridCacheDhtRemoveFailureTest.java | 16 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 2 +-
.../IgniteCacheCrossCacheTxFailoverTest.java | 53 +++--
.../IgniteCachePutRetryAbstractSelfTest.java | 166 ++++++++++++++--
.../dht/IgniteCachePutRetryAtomicSelfTest.java | 2 +
...gniteCachePutRetryTransactionalSelfTest.java | 50 +++--
...eAtomicInvalidPartitionHandlingSelfTest.java | 98 +++++++--
...tomicPrimaryWriteOrderRemoveFailureTest.java | 15 +-
.../GridCacheAtomicRemoveFailureTest.java | 15 +-
.../GridCacheAtomicNearRemoveFailureTest.java | 15 +-
...cPrimaryWriteOrderNearRemoveFailureTest.java | 15 +-
.../near/GridCacheNearRemoveFailureTest.java | 15 +-
.../GridCachePartitionedNodeRestartTest.java | 9 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 9 +-
.../GridCacheReplicatedNodeRestartSelfTest.java | 8 +-
.../offheap/GridOffHeapMapAbstractSelfTest.java | 16 +-
.../GridOffHeapMapPerformanceAbstractTest.java | 4 +-
...idOffHeapPartitionedMapAbstractSelfTest.java | 20 ++
.../unsafe/GridUnsafeMapPerformanceTest.java | 2 +-
.../offheap/unsafe/GridUnsafeMapSelfTest.java | 2 +-
.../GridOffHeapMapPerformanceAbstractTest.java | 4 +-
.../unsafe/GridUnsafeMapPerformanceTest.java | 2 +-
.../ignite/testframework/GridTestUtils.java | 117 +++++++++++
.../IgniteCacheFailoverTestSuite.java | 6 -
.../IgniteCacheFailoverTestSuite3.java | 62 ++++++
.../testsuites/IgniteCacheRestartTestSuite.java | 14 +-
.../IgniteCacheRestartTestSuite2.java | 47 +++++
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 31 ++-
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 4 +
.../IgniteCacheQueryMultiThreadedSelfTest.java | 9 +-
...QueryOffheapEvictsMultiThreadedSelfTest.java | 5 -
...lientQueryReplicatedNodeRestartSelfTest.java | 8 +-
.../IgniteCacheQueryNodeRestartSelfTest.java | 4 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 8 +-
62 files changed, 1584 insertions(+), 421 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
index 1554e07..dfa0217 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
@@ -843,7 +843,7 @@ public class CacheMetricsImpl implements CacheMetrics {
offHeapEvicts.incrementAndGet();
if (delegate != null)
- delegate.onOffHeapRemove();
+ delegate.onOffHeapEvict();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 9329e94..1fc94ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4096,21 +4096,22 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return t;
}
- catch (IgniteInterruptedCheckedException | IgniteTxHeuristicCheckedException |
- IgniteTxRollbackCheckedException e) {
+ catch (IgniteInterruptedCheckedException | IgniteTxHeuristicCheckedException e) {
throw e;
}
catch (IgniteCheckedException e) {
- try {
- tx.rollback();
+ if (!(e instanceof IgniteTxRollbackCheckedException)) {
+ try {
+ tx.rollback();
- e = new IgniteTxRollbackCheckedException("Transaction has been rolled back: " +
- tx.xid(), e);
- }
- catch (IgniteCheckedException | AssertionError | RuntimeException e1) {
- U.error(log, "Failed to rollback transaction (cache may contain stale locks): " + tx, e1);
+ e = new IgniteTxRollbackCheckedException("Transaction has been rolled back: " +
+ tx.xid(), e);
+ }
+ catch (IgniteCheckedException | AssertionError | RuntimeException e1) {
+ U.error(log, "Failed to rollback transaction (cache may contain stale locks): " + tx, e1);
- U.addLastCause(e, e1, log);
+ U.addLastCause(e, e1, log);
+ }
}
if (X.hasCause(e, ClusterTopologyCheckedException.class) && i != retries - 1) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 98e86ed..430590a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -867,6 +867,19 @@ public interface GridCacheEntryEx {
public void updateTtl(@Nullable GridCacheVersion ver, long ttl);
/**
+ * Tries to do offheap -> swap eviction.
+ *
+ * @param entry Serialized swap entry.
+ * @param evictVer Version when entry was selected for eviction.
+ * @param obsoleteVer Obsolete version.
+ * @throws IgniteCheckedException If failed.
+ * @throws GridCacheEntryRemovedException If entry was removed.
+ * @return {@code True} if entry was obsoleted and written to swap.
+ */
+ public boolean offheapSwapEvict(byte[] entry, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
+ throws IgniteCheckedException, GridCacheEntryRemovedException;
+
+ /**
* @return Value.
* @throws IgniteCheckedException If failed to read from swap storage.
* @throws GridCacheEntryRemovedException If entry was removed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index f60c0eb..3e0e2f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -958,7 +958,7 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
List<GridCacheEntryEx> locked = new ArrayList<>(keys.size());
- Set<GridCacheEntryEx> notRemove = null;
+ Set<GridCacheEntryEx> notRmv = null;
Collection<GridCacheBatchSwapEntry> swapped = new ArrayList<>(keys.size());
@@ -990,10 +990,10 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
locked.add(entry);
if (entry.obsolete()) {
- if (notRemove == null)
- notRemove = new HashSet<>();
+ if (notRmv == null)
+ notRmv = new HashSet<>();
- notRemove.add(entry);
+ notRmv.add(entry);
continue;
}
@@ -1004,11 +1004,19 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
GridCacheBatchSwapEntry swapEntry = entry.evictInBatchInternal(obsoleteVer);
if (swapEntry != null) {
+ assert entry.obsolete() : entry;
+
swapped.add(swapEntry);
if (log.isDebugEnabled())
log.debug("Entry was evicted [entry=" + entry + ", localNode=" + cctx.nodeId() + ']');
}
+ else if (!entry.obsolete()) {
+ if (notRmv == null)
+ notRmv = new HashSet<>();
+
+ notRmv.add(entry);
+ }
}
// Batch write to swap.
@@ -1025,7 +1033,7 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
// Remove entries and fire events outside the locks.
for (GridCacheEntryEx entry : locked) {
- if (entry.obsolete() && (notRemove == null || !notRemove.contains(entry))) {
+ if (entry.obsolete() && (notRmv == null || !notRmv.contains(entry))) {
entry.onMarkedObsolete();
cache.removeEntry(entry);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index eb4d864..f2bb646 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -433,6 +433,41 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
+ @Override public boolean offheapSwapEvict(byte[] entry, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
+ throws IgniteCheckedException, GridCacheEntryRemovedException {
+ assert cctx.swap().swapEnabled() && cctx.swap().offHeapEnabled() : this;
+
+ boolean obsolete;
+
+ synchronized (this) {
+ checkObsolete();
+
+ if (hasReaders() || !isStartVersion())
+ return false;
+
+ GridCacheMvcc mvcc = mvccExtras();
+
+ if (mvcc != null && !mvcc.isEmpty(obsoleteVer))
+ return false;
+
+ if (cctx.swap().offheapSwapEvict(key, entry, partition(), evictVer)) {
+ assert !hasValueUnlocked() : this;
+
+ obsolete = markObsolete0(obsoleteVer, false);
+
+ assert obsolete : this;
+ }
+ else
+ obsolete = false;
+ }
+
+ if (obsolete)
+ onMarkedObsolete();
+
+ return obsolete;
+ }
+
+ /** {@inheritDoc} */
@Override public CacheObject unswap() throws IgniteCheckedException, GridCacheEntryRemovedException {
return unswap(true);
}
@@ -536,7 +571,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
log.debug("Value did not change, skip write swap entry: " + this);
if (cctx.swap().offheapEvictionEnabled())
- cctx.swap().enableOffheapEviction(key());
+ cctx.swap().enableOffheapEviction(key(), partition());
return;
}
@@ -2988,7 +3023,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
synchronized (this) {
checkObsolete();
- if (isNew() || (!preload && deletedUnlocked())) {
+ if ((isNew() && !cctx.swap().containsKey(key, partition())) || (!preload && deletedUnlocked())) {
long expTime = expireTime < 0 ? CU.toExpireTime(ttl) : expireTime;
val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);
@@ -3643,6 +3678,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
try {
if (F.isEmptyOrNulls(filter)) {
synchronized (this) {
+ if (obsoleteVersionExtras() != null)
+ return true;
+
CacheObject prev = saveValueForIndexUnlocked();
if (!hasReaders() && markObsolete0(obsoleteVer, false)) {
@@ -3684,6 +3722,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
return false;
synchronized (this) {
+ if (obsoleteVersionExtras() != null)
+ return true;
+
if (!v.equals(ver))
// Version has changed since entry passed the filter. Do it again.
continue;
@@ -3768,6 +3809,13 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
try {
if (!hasReaders() && markObsolete0(obsoleteVer, false)) {
if (!isStartVersion() && hasValueUnlocked()) {
+ if (cctx.offheapTiered() && hasOffHeapPointer()) {
+ if (cctx.swap().offheapEvictionEnabled())
+ cctx.swap().enableOffheapEviction(key(), partition());
+
+ return null;
+ }
+
IgniteUuid valClsLdrId = null;
IgniteUuid keyClsLdrId = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
index 81490a7..b7c66d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
@@ -126,9 +126,9 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
* @return Version.
*/
public static GridCacheVersion version(byte[] bytes) {
- int off = VERSION_OFFSET; // Skip ttl, expire time.
+ long off = BYTE_ARR_OFF + VERSION_OFFSET; // Skip ttl, expire time.
- boolean verEx = bytes[off++] != 0;
+ boolean verEx = UNSAFE.getByte(bytes, off++) != 0;
return U.readVersion(bytes, off, verEx);
}
@@ -157,26 +157,6 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
return new IgniteBiTuple<>(valBytes, type);
}
- /**
- * @param bytes Entry bytes.
- * @return Value bytes offset.
- */
- public static int valueOffset(byte[] bytes) {
- assert bytes.length > 40 : bytes.length;
-
- int off = VERSION_OFFSET; // Skip ttl, expire time.
-
- boolean verEx = bytes[off++] != 0;
-
- off += verEx ? VERSION_EX_SIZE : VERSION_SIZE;
-
- off += 5; // Byte array flag + array size.
-
- assert bytes.length >= off;
-
- return off;
- }
-
/** {@inheritDoc} */
@Override public byte[] valueBytes() {
if (valBytes != null) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 7fd6013..9b6381e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -34,6 +34,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.managers.swapspace.GridSwapSpaceManager;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionAware;
@@ -54,6 +55,7 @@ import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.spi.swapspace.SwapKey;
@@ -101,8 +103,16 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
private final ReferenceQueue<Iterator<Map.Entry>> itQ = new ReferenceQueue<>();
/** Soft iterator set. */
- private final Collection<GridWeakIterator<Map.Entry>> itSet =
- new GridConcurrentHashSet<>();
+ private final Collection<GridWeakIterator<Map.Entry>> itSet = new GridConcurrentHashSet<>();
+
+ /** {@code True} if offheap to swap eviction is possible. */
+ private boolean offheapToSwapEvicts;
+
+ /** Values to be evicted from offheap to swap. */
+ private ThreadLocal<Collection<IgniteBiTuple<byte[], byte[]>>> offheapEvicts = new ThreadLocal<>();
+
+ /** First offheap eviction warning flag. */
+ private volatile boolean firstEvictWarn;
/**
* @param enabled Flag to indicate if swap is enabled.
@@ -127,9 +137,58 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
+ *
+ */
+ public void unwindOffheapEvicts() {
+ if (!offheapToSwapEvicts)
+ return;
+
+ Collection<IgniteBiTuple<byte[], byte[]>> evicts = offheapEvicts.get();
+
+ if (evicts != null) {
+ GridCacheVersion obsoleteVer = cctx.versions().next();
+
+ for (IgniteBiTuple<byte[], byte[]> t : evicts) {
+ try {
+ byte[] kb = t.get1();
+ byte[] vb = t.get2();
+
+ GridCacheVersion evictVer = GridCacheSwapEntryImpl.version(vb);
+
+ KeyCacheObject key = cctx.toCacheKeyObject(kb);
+
+ while (true) {
+ GridCacheEntryEx entry = cctx.cache().entryEx(key);
+
+ try {
+ if (entry.offheapSwapEvict(vb, evictVer, obsoleteVer))
+ cctx.cache().removeEntry(entry);
+
+ break;
+ }
+ catch (GridCacheEntryRemovedException ignore) {
+ // Retry.
+ }
+ }
+ }
+ catch (GridDhtInvalidPartitionException e) {
+ // Skip entry.
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to unmarshal off-heap entry", e);
+ }
+ }
+
+ offheapEvicts.set(null);
+ }
+ }
+
+ /**
* Initializes off-heap space.
*/
private void initOffHeap() {
+ assert offheapEnabled;
+
// Register big data usage.
long max = cctx.config().getOffHeapMaxMemory();
@@ -137,43 +196,69 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
int parts = cctx.config().getAffinity().partitions();
- GridOffHeapEvictListener lsnr = !swapEnabled && !offheapEnabled ? null : new GridOffHeapEvictListener() {
- private volatile boolean firstEvictWarn;
+ GridOffHeapEvictListener lsnr;
- @Override public void onEvict(int part, int hash, byte[] kb, byte[] vb) {
- try {
- if (!firstEvictWarn)
- warnFirstEvict();
+ if (swapEnabled) {
+ offheapToSwapEvicts = true;
- writeToSwap(part, cctx.toCacheKeyObject(kb), vb);
+ lsnr = new GridOffHeapEvictListener() {
+ @Override public void onEvict(int part, int hash, byte[] kb, byte[] vb) {
+ assert offheapToSwapEvicts;
- if (cctx.config().isStatisticsEnabled())
- cctx.cache().metrics0().onOffHeapEvict();
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to unmarshal off-heap entry [part=" + part + ", hash=" + hash + ']', e);
- }
- }
+ onOffheapEvict();
- private void warnFirstEvict() {
- synchronized (this) {
- if (firstEvictWarn)
- return;
+ Collection<IgniteBiTuple<byte[], byte[]>> evicts = offheapEvicts.get();
- firstEvictWarn = true;
+ if (evicts == null)
+ offheapEvicts.set(evicts = new ArrayList<>());
+
+ evicts.add(new IgniteBiTuple<>(kb, vb));
}
- U.warn(log, "Off-heap evictions started. You may wish to increase 'offHeapMaxMemory' in " +
- "cache configuration [cache=" + cctx.name() +
- ", offHeapMaxMemory=" + cctx.config().getOffHeapMaxMemory() + ']',
- "Off-heap evictions started: " + cctx.name());
- }
- };
+ @Override public boolean removeEvicted() {
+ return false;
+ }
+ };
+ }
+ else {
+ lsnr = new GridOffHeapEvictListener() {
+ @Override public void onEvict(int part, int hash, byte[] kb, byte[] vb) {
+ onOffheapEvict();
+ }
+
+ @Override public boolean removeEvicted() {
+ return true;
+ }
+ };
+ }
offheap.create(spaceName, parts, init, max, lsnr);
}
/**
+ * Warns on first evict from off-heap.
+ */
+ private void onOffheapEvict() {
+ if (cctx.config().isStatisticsEnabled())
+ cctx.cache().metrics0().onOffHeapEvict();
+
+ if (firstEvictWarn)
+ return;
+
+ synchronized (this) {
+ if (firstEvictWarn)
+ return;
+
+ firstEvictWarn = true;
+ }
+
+ U.warn(log, "Off-heap evictions started. You may wish to increase 'offHeapMaxMemory' in " +
+ "cache configuration [cache=" + cctx.name() +
+ ", offHeapMaxMemory=" + cctx.config().getOffHeapMaxMemory() + ']',
+ "Off-heap evictions started: " + cctx.name());
+ }
+
+ /**
* @return {@code True} if swap store is enabled.
*/
public boolean swapEnabled() {
@@ -440,17 +525,16 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/**
* @param key Key to check.
+ * @param part Partition.
* @return {@code True} if key is contained.
* @throws IgniteCheckedException If failed.
*/
- public boolean containsKey(KeyCacheObject key) throws IgniteCheckedException {
+ public boolean containsKey(KeyCacheObject key, int part) throws IgniteCheckedException {
if (!offheapEnabled && !swapEnabled)
return false;
checkIteratorQueue();
- int part = cctx.affinity().partition(key);
-
// First check off-heap store.
if (offheapEnabled) {
boolean contains = offheap.contains(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
@@ -480,6 +564,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/**
* @param key Key to read.
+ * @param keyBytes Key bytes.
* @param part Key partition.
* @param entryLocked {@code True} if cache entry is locked.
* @param readOffheap Read offheap flag.
@@ -966,6 +1051,46 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
+ * @param key Key to move from offheap to swap.
+ * @param entry Serialized swap entry.
+ * @param part Partition.
+ * @param ver Expected entry version.
+ * @return {@code True} if removed.
+ * @throws IgniteCheckedException If failed.
+ */
+ boolean offheapSwapEvict(final KeyCacheObject key, byte[] entry, int part, final GridCacheVersion ver)
+ throws IgniteCheckedException {
+ assert offheapEnabled;
+
+ checkIteratorQueue();
+
+ boolean rmv = offheap.removex(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()),
+ new IgniteBiPredicate<Long, Integer>() {
+ @Override public boolean apply(Long ptr, Integer len) {
+ GridCacheVersion ver0 = GridCacheOffheapSwapEntry.version(ptr);
+
+ return ver.equals(ver0);
+ }
+ }
+ );
+
+ if (rmv) {
+ Collection<GridCacheSwapListener> lsnrs = offheapLsnrs.get(part);
+
+ if (lsnrs != null) {
+ GridCacheSwapEntry e = swapEntry(GridCacheSwapEntryImpl.unmarshal(entry));
+
+ for (GridCacheSwapListener lsnr : lsnrs)
+ lsnr.onEntryUnswapped(part, key, e);
+ }
+
+ cctx.swap().writeToSwap(part, key, entry);
+ }
+
+ return rmv;
+ }
+
+ /**
* @return {@code True} if offheap eviction is enabled.
*/
boolean offheapEvictionEnabled() {
@@ -976,16 +1101,15 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
* Enables eviction for offheap entry after {@link #readOffheapPointer} was called.
*
* @param key Key.
+ * @param part Partition.
* @throws IgniteCheckedException If failed.
*/
- void enableOffheapEviction(final KeyCacheObject key) throws IgniteCheckedException {
+ void enableOffheapEviction(final KeyCacheObject key, int part) throws IgniteCheckedException {
if (!offheapEnabled)
return;
checkIteratorQueue();
- int part = cctx.affinity().partition(key);
-
offheap.enableEviction(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 980971c..2d5698a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1029,8 +1029,15 @@ public class GridCacheUtils {
ctx.evicts().unwind();
- if (ctx.isNear())
- ctx.near().dht().context().evicts().unwind();
+ ctx.swap().unwindOffheapEvicts();
+
+ if (ctx.isNear()) {
+ GridCacheContext dhtCtx = ctx.near().dht().context();
+
+ dhtCtx.evicts().unwind();
+
+ dhtCtx.swap().unwindOffheapEvicts();
+ }
ctx.ttl().expire();
}
@@ -1041,14 +1048,8 @@ public class GridCacheUtils {
public static <K, V> void unwindEvicts(GridCacheSharedContext<K, V> ctx) {
assert ctx != null;
- for (GridCacheContext<K, V> cacheCtx : ctx.cacheContexts()) {
- cacheCtx.evicts().unwind();
-
- if (cacheCtx.isNear())
- cacheCtx.near().dht().context().evicts().unwind();
-
- cacheCtx.ttl().expire();
- }
+ for (GridCacheContext<K, V> cacheCtx : ctx.cacheContexts())
+ unwindEvicts(cacheCtx);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index c5f15cd..956f2bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -262,8 +262,11 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
map.put(entry.key(), entry);
- if (!entry.isInternal())
+ if (!entry.isInternal()) {
+ assert !entry.deleted() : entry;
+
mapPubSize.increment();
+ }
}
/**
@@ -271,7 +274,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
*/
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
void onRemoved(GridDhtCacheEntry entry) {
- assert entry.obsolete();
+ assert entry.obsolete() : entry;
// Make sure to remove exactly this entry.
synchronized (entry) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 5e183e9..fcb012f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -546,10 +546,13 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
* @param updateSeq Update sequence.
* @return Local partition.
*/
- private GridDhtLocalPartition localPartition(int p, AffinityTopologyVersion topVer, boolean create, boolean updateSeq) {
- while (true) {
- boolean belongs = cctx.affinity().localNode(p, topVer);
+ private GridDhtLocalPartition localPartition(int p,
+ AffinityTopologyVersion topVer,
+ boolean create,
+ boolean updateSeq) {
+ boolean belongs = create && cctx.affinity().localNode(p, topVer);
+ while (true) {
GridDhtLocalPartition loc = locParts.get(p);
if (loc != null && loc.state() == EVICTED) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 3f9decf..2048fdf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -234,6 +234,8 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
/**
* Completeness callback.
+ *
+ * @return {@code True} if future was finished by this call.
*/
private boolean onComplete() {
Throwable err0 = err.get();
@@ -457,6 +459,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
/**
* @param reads Read entries.
* @param writes Write entries.
+ * @throws IgniteCheckedException If failed.
*/
private void prepare(
Iterable<IgniteTxEntry> reads,
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 21aaef2..ab6dc3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -404,8 +404,13 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
if (backup == null) {
readyNearMappingFromBackup(mapping);
+ ClusterTopologyCheckedException cause =
+ new ClusterTopologyCheckedException("Backup node left grid: " + backupId);
+
+ cause.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
+
mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
- "(backup has left grid): " + tx.xidVersion()));
+ "(backup has left grid): " + tx.xidVersion(), cause));
}
else if (backup.isLocal()) {
boolean committed = cctx.tm().txHandler().checkDhtRemoteTxCommitted(tx.xidVersion());
@@ -414,9 +419,15 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
if (committed)
mini.onDone(tx);
- else
+ else {
+ ClusterTopologyCheckedException cause =
+ new ClusterTopologyCheckedException("Primary node left grid: " + nodeId);
+
+ cause.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
+
mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
- "(transaction has been rolled back on backup node): " + tx.xidVersion()));
+ "(transaction has been rolled back on backup node): " + tx.xidVersion(), cause));
+ }
}
else {
GridDhtTxFinishRequest finishReq = new GridDhtTxFinishRequest(
@@ -731,8 +742,19 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
readyNearMappingFromBackup(m);
- if (res.checkCommittedError() != null)
- onDone(res.checkCommittedError());
+ Throwable err = res.checkCommittedError();
+
+ if (err != null) {
+ if (err instanceof IgniteCheckedException) {
+ ClusterTopologyCheckedException cause =
+ ((IgniteCheckedException)err).getCause(ClusterTopologyCheckedException.class);
+
+ if (cause != null)
+ cause.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
+ }
+
+ onDone(err);
+ }
else
onDone(tx);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 9efa43a..756672a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -1049,6 +1049,7 @@ public class IgniteTxHandler {
*
* @param nodeId Node id that originated finish request.
* @param req Request.
+ * @param {@code True} if transaction committed on this node.
*/
protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committed) {
if (req.replyRequired()) {
@@ -1057,9 +1058,13 @@ public class IgniteTxHandler {
if (req.checkCommitted()) {
res.checkCommitted(true);
- if (!committed)
+ if (!committed) {
+ ClusterTopologyCheckedException cause =
+ new ClusterTopologyCheckedException("Primary node left grid.");
+
res.checkCommittedError(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
- "(transaction has been rolled back on backup node): " + req.version()));
+ "(transaction has been rolled back on backup node): " + req.version(), cause));
+ }
}
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
index 024ea7c..492fa07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.util.offheap.GridOffHeapPartitionedMap;
import org.apache.ignite.internal.util.typedef.CX2;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.marshaller.Marshaller;
import org.jetbrains.annotations.Nullable;
@@ -261,13 +262,35 @@ public class GridOffHeapProcessor extends GridProcessorAdapter {
* @return {@code true} If succeeded.
* @throws IgniteCheckedException If failed.
*/
- public boolean removex(@Nullable String spaceName, int part, KeyCacheObject key, byte[] keyBytes) throws IgniteCheckedException {
+ public boolean removex(@Nullable String spaceName, int part, KeyCacheObject key, byte[] keyBytes)
+ throws IgniteCheckedException {
GridOffHeapPartitionedMap m = offheap(spaceName);
return m != null && m.removex(part, U.hash(key), keyBytes(key, keyBytes));
}
/**
+ * Removes value from offheap space for the given key.
+ *
+ * @param spaceName Space name.
+ * @param part Partition.
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param p Value predicate (arguments are value address and value length).
+ * @return {@code true} If succeeded.
+ * @throws IgniteCheckedException If failed.
+ */
+ public boolean removex(@Nullable String spaceName,
+ int part,
+ KeyCacheObject key,
+ byte[] keyBytes,
+ IgniteBiPredicate<Long, Integer> p) throws IgniteCheckedException {
+ GridOffHeapPartitionedMap m = offheap(spaceName);
+
+ return m != null && m.removex(part, U.hash(key), keyBytes(key, keyBytes), p);
+ }
+
+ /**
* Gets iterator over contents of the given space.
*
* @param spaceName Space name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapEvictListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapEvictListener.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapEvictListener.java
index 4597be8..beafea4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapEvictListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapEvictListener.java
@@ -30,4 +30,9 @@ public interface GridOffHeapEvictListener {
* @param valBytes Value bytes.
*/
public void onEvict(int part, int hash, byte[] keyBytes, byte[] valBytes);
+
+ /**
+ * @return {@code True} if entry selected for eviction should be immediately removed.
+ */
+ public boolean removeEvicted();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
index 1fcddd7..d14a582 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMap.java
@@ -20,13 +20,14 @@ package org.apache.ignite.internal.util.offheap;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.typedef.CX2;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
/**
* Off-heap map.
*/
-public interface GridOffHeapMap<K> {
+public interface GridOffHeapMap {
/**
* Gets partition this map belongs to.
*
@@ -102,6 +103,16 @@ public interface GridOffHeapMap<K> {
public boolean removex(int hash, byte[] keyBytes);
/**
+ * Removes value from off-heap map without returning it.
+ *
+ * @param hash Hash.
+ * @param keyBytes Key bytes.
+ * @param p Value predicate (arguments are value address and value length).
+ * @return {@code True} if value was removed.
+ */
+ public boolean removex(int hash, byte[] keyBytes, IgniteBiPredicate<Long, Integer> p);
+
+ /**
* Puts key and value bytes into the map potentially replacing
* existing entry.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapFactory.java
index 1a3d219..4dd911f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapFactory.java
@@ -32,8 +32,8 @@ public class GridOffHeapMapFactory {
* @param initCap Initial capacity.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(long initCap) {
- return new GridUnsafeMap<>(128, 0.75f, initCap, 0, (short)0, null);
+ public static GridOffHeapMap unsafeMap(long initCap) {
+ return new GridUnsafeMap(128, 0.75f, initCap, 0, (short)0, null);
}
/**
@@ -43,8 +43,8 @@ public class GridOffHeapMapFactory {
* @param initCap Initial capacity.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(int concurrency, long initCap) {
- return new GridUnsafeMap<>(concurrency, 0.75f, initCap, 0, (short)0, null);
+ public static GridOffHeapMap unsafeMap(int concurrency, long initCap) {
+ return new GridUnsafeMap(concurrency, 0.75f, initCap, 0, (short)0, null);
}
/**
@@ -55,8 +55,8 @@ public class GridOffHeapMapFactory {
* @param initCap Initial capacity.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(int concurrency, float load, long initCap) {
- return new GridUnsafeMap<>(concurrency, load, initCap, 0, (short)0, null);
+ public static GridOffHeapMap unsafeMap(int concurrency, float load, long initCap) {
+ return new GridUnsafeMap(concurrency, load, initCap, 0, (short)0, null);
}
/**
@@ -68,8 +68,8 @@ public class GridOffHeapMapFactory {
* @param lruStripes Number of LRU stripes.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(long initCap, long totalMem, short lruStripes) {
- return new GridUnsafeMap<>(128, 0.75f, initCap, totalMem, lruStripes, null);
+ public static GridOffHeapMap unsafeMap(long initCap, long totalMem, short lruStripes) {
+ return new GridUnsafeMap(128, 0.75f, initCap, totalMem, lruStripes, null);
}
/**
@@ -82,9 +82,9 @@ public class GridOffHeapMapFactory {
* @param lsnr Optional eviction listener which gets notified every time an entry is evicted.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(long initCap, long totalMem, short lruStripes,
+ public static GridOffHeapMap unsafeMap(long initCap, long totalMem, short lruStripes,
@Nullable GridOffHeapEvictListener lsnr) {
- return new GridUnsafeMap<>(128, 0.75f, initCap, totalMem, lruStripes, lsnr);
+ return new GridUnsafeMap(128, 0.75f, initCap, totalMem, lruStripes, lsnr);
}
/**
@@ -98,9 +98,9 @@ public class GridOffHeapMapFactory {
* @param lsnr Optional eviction listener which gets notified every time an entry is evicted.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(int concurrency, long initCap, long totalMem, short lruStripes,
+ public static GridOffHeapMap unsafeMap(int concurrency, long initCap, long totalMem, short lruStripes,
@Nullable GridOffHeapEvictListener lsnr) {
- return new GridUnsafeMap<>(concurrency, 0.75f, initCap, totalMem, lruStripes, lsnr);
+ return new GridUnsafeMap(concurrency, 0.75f, initCap, totalMem, lruStripes, lsnr);
}
/**
@@ -115,9 +115,9 @@ public class GridOffHeapMapFactory {
* @param lsnr Optional eviction listener which gets notified every time an entry is evicted.
* @return Off-heap map.
*/
- public static <K> GridOffHeapMap<K> unsafeMap(int concurrency, float load, long initCap, long totalMem,
+ public static <K> GridOffHeapMap unsafeMap(int concurrency, float load, long initCap, long totalMem,
short lruStripes, @Nullable GridOffHeapEvictListener lsnr) {
- return new GridUnsafeMap<>(concurrency, load, initCap, totalMem, lruStripes, lsnr);
+ return new GridUnsafeMap(concurrency, load, initCap, totalMem, lruStripes, lsnr);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
index 3afdfa9..c1e1bfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
@@ -21,6 +21,7 @@ import java.util.Set;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.typedef.CX2;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
@@ -111,6 +112,17 @@ public interface GridOffHeapPartitionedMap {
public boolean removex(int p, int hash, byte[] keyBytes);
/**
+ * Removes value from off-heap map without returning it.
+ *
+ * @param part Partition.
+ * @param hash Hash.
+ * @param keyBytes Key bytes.
+ * @param p Value predicate (arguments are value address and value length).
+ * @return {@code True} if value was removed.
+ */
+ public boolean removex(int part, int hash, byte[] keyBytes, IgniteBiPredicate<Long, Integer> p);
+
+ /**
* Puts key and value bytes into the map potentially replacing
* existing entry.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
index 40fb3e8..359d36c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMap.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.util.typedef.CX2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
import org.jsr166.LongAdder8;
@@ -42,7 +43,7 @@ import static org.apache.ignite.internal.util.offheap.GridOffHeapEvent.REHASH;
/**
* Off-heap map based on {@code Unsafe} implementation.
*/
-public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
+public class GridUnsafeMap implements GridOffHeapMap {
/** Header size. */
private static final int HEADER = 4 /*hash*/ + 4 /*key-size*/ + 4 /*value-size*/ + 8 /*queue-address*/ +
8 /*next-address*/;
@@ -77,7 +78,7 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
private final float load;
/** Segments. */
- private final Segment<K>[] segs;
+ private final Segment[] segs;
/** Total memory. */
private final GridUnsafeMemory mem;
@@ -111,6 +112,9 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
/** LRU poller. */
private final GridUnsafeLruPoller lruPoller;
+ /** */
+ private final boolean rmvEvicted;
+
/**
* @param concurrency Concurrency.
* @param load Load factor.
@@ -180,6 +184,8 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
}
}
};
+
+ rmvEvicted = evictLsnr == null || evictLsnr.removeEvicted();
}
/**
@@ -225,6 +231,8 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
segs = new Segment[size];
init(initCap, size);
+
+ rmvEvicted = evictLsnr == null || evictLsnr.removeEvicted();
}
/**
@@ -247,7 +255,7 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
for (int i = 0; i < size; i++) {
try {
- segs[i] = new Segment<>(i, cap);
+ segs[i] = new Segment(i, cap);
}
catch (GridOffHeapOutOfMemoryException e) {
destruct();
@@ -327,6 +335,11 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
}
/** {@inheritDoc} */
+ @Override public boolean removex(int hash, byte[] keyBytes, IgniteBiPredicate<Long, Integer> p) {
+ return segmentFor(hash).removex(hash, keyBytes, p);
+ }
+
+ /** {@inheritDoc} */
@Override public boolean put(int hash, byte[] keyBytes, byte[] valBytes) {
return segmentFor(hash).put(hash, keyBytes, valBytes);
}
@@ -559,7 +572,7 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
/**
* Segment.
*/
- private class Segment<K> {
+ private class Segment {
/** Lock. */
private final ReadWriteLock lock = new ReentrantReadWriteLock();
@@ -1009,41 +1022,51 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
}
if (cur != 0) {
- long next = Entry.nextAddress(cur, mem);
+ long qAddr0 = Entry.queueAddress(cur, mem);
- if (prev != 0)
- Entry.nextAddress(prev, next, mem); // Relink.
- else {
- if (next == 0)
- Bin.clear(binAddr, mem);
- else
- Bin.first(binAddr, next, mem);
- }
+ assert qAddr == qAddr0 : "Queue node address mismatch " +
+ "[qAddr=" + qAddr + ", entryQueueAddr=" + qAddr + ']';
if (evictLsnr != null) {
keyBytes = Entry.readKeyBytes(cur, mem);
- // TODO: GG-8123: Inlined as a workaround. Revert when 7u60 is released.
-// valBytes = Entry.readValueBytes(cur, mem);
- {
- int keyLen = Entry.readKeyLength(cur, mem);
- int valLen = Entry.readValueLength(cur, mem);
+ int keyLen = Entry.readKeyLength(cur, mem);
+ int valLen = Entry.readValueLength(cur, mem);
- valBytes = mem.readBytes(cur + HEADER + keyLen, valLen);
- }
+ valBytes = mem.readBytes(cur + HEADER + keyLen, valLen);
}
- long a;
+ if (rmvEvicted) {
+ long a;
- assert qAddr == (a = Entry.queueAddress(cur, mem)) : "Queue node address mismatch " +
- "[qAddr=" + qAddr + ", entryQueueAddr=" + a + ']';
+ assert qAddr == (a = Entry.queueAddress(cur, mem)) : "Queue node address mismatch " +
+ "[qAddr=" + qAddr + ", entryQueueAddr=" + a + ']';
- relSize = Entry.size(cur, mem);
- relAddr = cur;
+ long next = Entry.nextAddress(cur, mem);
- cnt--;
+ if (prev != 0)
+ Entry.nextAddress(prev, next, mem); // Relink.
+ else {
+ if (next == 0)
+ Bin.clear(binAddr, mem);
+ else
+ Bin.first(binAddr, next, mem);
+ }
- totalCnt.decrement();
+ relSize = Entry.size(cur, mem);
+ relAddr = cur;
+
+ cnt--;
+
+ totalCnt.decrement();
+ }
+ else {
+ boolean clear = Entry.clearQueueAddress(cur, qAddr, mem);
+
+ assert clear;
+
+ relSize = Entry.size(cur, mem);
+ }
}
}
}
@@ -1251,7 +1274,7 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
*/
@SuppressWarnings("TooBroadScope")
byte[] remove(int hash, byte[] keyBytes) {
- return remove(hash, keyBytes, true);
+ return remove(hash, keyBytes, true, null);
}
/**
@@ -1260,17 +1283,28 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
* @return {@code True} if value was removed.
*/
boolean removex(int hash, byte[] keyBytes) {
- return remove(hash, keyBytes, false) == EMPTY_BYTES;
+ return remove(hash, keyBytes, false, null) == EMPTY_BYTES;
+ }
+
+ /**
+ * @param hash Hash.
+ * @param keyBytes Key bytes.
+ * @param p Value predicate.
+ * @return {@code True} if value was removed.
+ */
+ boolean removex(int hash, byte[] keyBytes, IgniteBiPredicate<Long, Integer> p) {
+ return remove(hash, keyBytes, false, p) == EMPTY_BYTES;
}
/**
* @param hash Hash.
* @param keyBytes Key bytes.
* @param retval {@code True} if need removed value.
+ * @param p Value predicate.
* @return Removed value bytes.
*/
@SuppressWarnings("TooBroadScope")
- byte[] remove(int hash, byte[] keyBytes, boolean retval) {
+ byte[] remove(int hash, byte[] keyBytes, boolean retval, @Nullable IgniteBiPredicate<Long, Integer> p) {
int relSize = 0;
long relAddr = 0;
long qAddr = 0;
@@ -1291,6 +1325,19 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
// If found match.
if (Entry.keyEquals(cur, keyBytes, mem)) {
+ int keyLen = 0;
+ int valLen = 0;
+
+ if (p != null) {
+ keyLen = Entry.readKeyLength(cur, mem);
+ valLen = Entry.readValueLength(cur, mem);
+
+ long valPtr = cur + HEADER + keyLen;
+
+ if (!p.apply(valPtr, valLen))
+ return null;
+ }
+
if (prev != 0)
Entry.nextAddress(prev, next, mem); // Relink.
else {
@@ -1300,18 +1347,16 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
Bin.first(binAddr, next, mem);
}
- // TODO: GG-8123: Inlined as a workaround. Revert when 7u60 is released.
-// valBytes = retval ? Entry.readValueBytes(cur, mem) : EMPTY_BYTES;
- {
- if (retval) {
- int keyLen = Entry.readKeyLength(cur, mem);
- int valLen = Entry.readValueLength(cur, mem);
-
- valBytes = mem.readBytes(cur + HEADER + keyLen, valLen);
+ if (retval) {
+ if (keyLen == 0) {
+ keyLen = Entry.readKeyLength(cur, mem);
+ valLen = Entry.readValueLength(cur, mem);
}
- else
- valBytes = EMPTY_BYTES;
+
+ valBytes = mem.readBytes(cur + HEADER + keyLen, valLen);
}
+ else
+ valBytes = EMPTY_BYTES;
// Prepare release of memory.
qAddr = Entry.queueAddress(cur, mem);
@@ -1382,8 +1427,7 @@ public class GridUnsafeMap<K> implements GridOffHeapMap<K> {
* @param keyBytes Key bytes.
* @return Value pointer.
*/
- @Nullable
- IgniteBiTuple<Long, Integer> valuePointer(int hash, byte[] keyBytes) {
+ @Nullable IgniteBiTuple<Long, Integer> valuePointer(int hash, byte[] keyBytes) {
long binAddr = readLock(hash);
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
index 070da51..fb8ac14 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.util.offheap.GridOffHeapMap;
import org.apache.ignite.internal.util.offheap.GridOffHeapPartitionedMap;
import org.apache.ignite.internal.util.typedef.CX2;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
import org.jsr166.LongAdder8;
@@ -198,6 +199,14 @@ public class GridUnsafePartitionedMap implements GridOffHeapPartitionedMap {
}
/** {@inheritDoc} */
+ @Override public boolean removex(int part,
+ int hash,
+ byte[] keyBytes,
+ IgniteBiPredicate<Long, Integer> p) {
+ return mapFor(part).removex(hash, keyBytes, p);
+ }
+
+ /** {@inheritDoc} */
@Override public boolean put(int p, int hash, byte[] keyBytes, byte[] valBytes) {
return mapFor(p).put(hash, keyBytes, valBytes);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java
index 271d8b1..214beb6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -53,6 +54,12 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest {
/** */
private static final long DURATION = 30_000;
+ /** */
+ private static final long OFFHEAP_MEM = 1000;
+
+ /** */
+ private static final int MAX_HEAP_SIZE = 100;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -81,7 +88,7 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest {
if (memMode == CacheMemoryMode.ONHEAP_TIERED) {
LruEvictionPolicy plc = new LruEvictionPolicy();
- plc.setMaxSize(100);
+ plc.setMaxSize(MAX_HEAP_SIZE);
ccfg.setEvictionPolicy(plc);
}
@@ -89,7 +96,7 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest {
if (swap) {
ccfg.setSwapEnabled(true);
- ccfg.setOffHeapMaxMemory(1000);
+ ccfg.setOffHeapMaxMemory(OFFHEAP_MEM);
}
else
ccfg.setOffHeapMaxMemory(0);
@@ -133,6 +140,20 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testTxCacheOffheapSwapEvict() throws Exception {
+ swapUnswap(TRANSACTIONAL, CacheMemoryMode.ONHEAP_TIERED, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTxCacheOffheapTieredSwapEvict() throws Exception {
+ swapUnswap(TRANSACTIONAL, CacheMemoryMode.OFFHEAP_TIERED, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testAtomicCacheOffheapEvict() throws Exception {
swapUnswap(ATOMIC, CacheMemoryMode.ONHEAP_TIERED, false);
}
@@ -145,6 +166,20 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testAtomicCacheOffheapSwapEvict() throws Exception {
+ swapUnswap(ATOMIC, CacheMemoryMode.ONHEAP_TIERED, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAtomicCacheOffheapTieredSwapEvict() throws Exception {
+ swapUnswap(ATOMIC, CacheMemoryMode.OFFHEAP_TIERED, true);
+ }
+
+ /**
* @param atomicityMode Cache atomicity mode.
* @param memMode Cache memory mode.
* @param swap {@code True} if swap enabled.
@@ -220,12 +255,56 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest {
}
});
- Thread.sleep(DURATION);
+ long endTime = System.currentTimeMillis() + DURATION;
+
+ while (System.currentTimeMillis() < endTime) {
+ Thread.sleep(5000);
+
+ log.info("Cache size [heap=" + cache.localSize(CachePeekMode.ONHEAP) +
+ ", offheap=" + cache.localSize(CachePeekMode.OFFHEAP) +
+ ", swap=" + cache.localSize(CachePeekMode.SWAP) +
+ ", total=" + cache.localSize() +
+ ", offheapMem=" + cache.metrics().getOffHeapAllocatedSize() + ']');
+ }
done.set(true);
fut.get();
getFut.get();
+
+ for (Integer key : keys) {
+ String val = cache.get(key);
+
+ assertNotNull(val);
+ }
+
+ int onheapSize = cache.localSize(CachePeekMode.ONHEAP);
+ int offheapSize = cache.localSize(CachePeekMode.OFFHEAP);
+ int swapSize = cache.localSize(CachePeekMode.SWAP);
+ int total = cache.localSize();
+ long offheapMem = cache.metrics().getOffHeapAllocatedSize();
+
+ log.info("Cache size [heap=" + onheapSize +
+ ", offheap=" + offheapSize +
+ ", swap=" + swapSize +
+ ", total=" + total +
+ ", offheapMem=" + offheapMem + ']');
+
+ assertTrue(total > 0);
+
+ assertEquals(onheapSize + offheapSize + swapSize, total);
+
+ if (memMode == CacheMemoryMode.OFFHEAP_TIERED)
+ assertEquals(0, onheapSize);
+ else
+ assertEquals(MAX_HEAP_SIZE, onheapSize);
+
+ if (swap) {
+ assertTrue(swapSize > 0);
+ assertTrue(offheapMem <= OFFHEAP_MEM);
+ }
+ else
+ assertEquals(0, swapSize);
}
finally {
done.set(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 3e646d3..2a64963 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -2825,7 +2825,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
try {
cache.clear();
- assertEquals(vals.get(first), cache.localPeek(first, ONHEAP));
+ GridCacheContext<String, Integer> cctx = context(0);
+
+ GridCacheEntryEx entry = cctx.isNear() ? cctx.near().dht().peekEx(first) :
+ cctx.cache().peekEx(first);
+
+ assertNotNull(entry);
}
finally {
lock.unlock();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
index 31488e0..647746e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
@@ -21,38 +21,50 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.atomic.AtomicReference;
import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.lang.GridTuple;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jsr166.ConcurrentHashMap8;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Tests that removes are not lost when topology changes.
*/
-public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstractSelfTest {
+public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
/** */
private static final int GRID_CNT = 3;
/** Keys count. */
- private static final int KEYS_CNT = 10000;
+ private static final int KEYS_CNT = 10_000;
/** Test duration. */
private static final long DUR = 90 * 1000L;
@@ -66,36 +78,21 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
/** Start delay. */
private static final T2<Integer, Integer> START_DELAY = new T2<>(2000, 5000);
- /** Node kill lock (used to prevent killing while cache data is compared). */
- private final Lock killLock = new ReentrantLock();
-
/** */
- private CountDownLatch assertLatch;
-
- /** */
- private CountDownLatch updateLatch;
-
- /** Caches comparison request flag. */
- private volatile boolean cmp;
-
- /** */
- private String sizePropVal;
+ private static String sizePropVal;
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER).setForceServerMode(true);
if (testClientNode() && getTestGridName(0).equals(gridName))
cfg.setClientMode(true);
- return cfg;
- }
+ cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return GRID_CNT;
+ return cfg;
}
/** {@inheritDoc} */
@@ -104,6 +101,8 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
sizePropVal = System.getProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE);
System.setProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "100000");
+
+ startGrids(GRID_CNT);
}
/** {@inheritDoc} */
@@ -111,15 +110,7 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
super.afterTestsStopped();
System.setProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, sizePropVal != null ? sizePropVal : "");
- }
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startGrids(gridCount());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
stopAllGrids();
}
@@ -129,6 +120,28 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
}
/**
+ * @return Cache mode.
+ */
+ protected abstract CacheMode cacheMode();
+
+ /**
+ * @return Cache atomicity mode.
+ */
+ protected abstract CacheAtomicityMode atomicityMode();
+
+ /**
+ * @return Near cache configuration.
+ */
+ protected abstract NearCacheConfiguration nearCache();
+
+ /**
+ * @return Atomic cache write order mode.
+ */
+ protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+ return null;
+ }
+
+ /**
* @return {@code True} if test updates from client node.
*/
protected boolean testClientNode() {
@@ -139,9 +152,49 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
* @throws Exception If failed.
*/
public void testPutAndRemove() throws Exception {
- assertEquals(testClientNode(), (boolean)grid(0).configuration().isClientMode());
+ putAndRemove(DUR, GridTestUtils.TestMemoryMode.HEAP);
+ }
- final IgniteCache<Integer, Integer> sndCache0 = grid(0).cache(null);
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAndRemoveOffheapEvict() throws Exception {
+ putAndRemove(30_000, GridTestUtils.TestMemoryMode.OFFHEAP_EVICT);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAndRemoveOffheapEvictSwap() throws Exception {
+ putAndRemove(30_000, GridTestUtils.TestMemoryMode.OFFHEAP_EVICT_SWAP);
+ }
+
+ /**
+ * @param duration Test duration.
+ * @param memMode Memory mode.
+ * @throws Exception If failed.
+ */
+ private void putAndRemove(long duration, GridTestUtils.TestMemoryMode memMode) throws Exception {
+ assertEquals(testClientNode(), (boolean) grid(0).configuration().isClientMode());
+
+ grid(0).destroyCache(null);
+
+ CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ ccfg.setCacheMode(cacheMode());
+
+ if (cacheMode() == PARTITIONED)
+ ccfg.setBackups(1);
+
+ ccfg.setAtomicityMode(atomicityMode());
+ ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
+ ccfg.setNearConfiguration(nearCache());
+
+ GridTestUtils.setMemoryMode(null, ccfg, memMode, 100, 1024);
+
+ final IgniteCache<Integer, Integer> sndCache0 = grid(0).createCache(ccfg);
final AtomicBoolean stop = new AtomicBoolean();
@@ -152,8 +205,12 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
// Expected values in cache.
final Map<Integer, GridTuple<Integer>> expVals = new ConcurrentHashMap8<>();
+ final AtomicReference<CyclicBarrier> cmp = new AtomicReference<>();
+
IgniteInternalFuture<?> updateFut = GridTestUtils.runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
+ Thread.currentThread().setName("update-thread");
+
ThreadLocalRandom rnd = ThreadLocalRandom.current();
while (!stop.get()) {
@@ -190,10 +247,14 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
cntr.addAndGet(100);
- if (cmp) {
- assertLatch.countDown();
+ CyclicBarrier barrier = cmp.get();
+
+ if (barrier != null) {
+ log.info("Wait data check.");
- updateLatch.await();
+ barrier.await(60_000, TimeUnit.MILLISECONDS);
+
+ log.info("Finished wait data check.");
}
}
@@ -203,16 +264,21 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
IgniteInternalFuture<?> killFut = GridTestUtils.runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
+ Thread.currentThread().setName("restart-thread");
+
while (!stop.get()) {
U.sleep(random(KILL_DELAY.get1(), KILL_DELAY.get2()));
- killLock.lock();
+ killAndRestart(stop);
- try {
- killAndRestart(stop);
- }
- finally {
- killLock.unlock();
+ CyclicBarrier barrier = cmp.get();
+
+ if (barrier != null) {
+ log.info("Wait data check.");
+
+ barrier.await(60_000, TimeUnit.MILLISECONDS);
+
+ log.info("Finished wait data check.");
}
}
@@ -221,7 +287,7 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
});
try {
- long stopTime = DUR + U.currentTimeMillis() ;
+ long stopTime = duration + U.currentTimeMillis() ;
long nextAssert = U.currentTimeMillis() + ASSERT_FREQ;
@@ -241,31 +307,34 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
log.info("Operations/second: " + opsPerSecond);
if (U.currentTimeMillis() >= nextAssert) {
- updateLatch = new CountDownLatch(1);
+ CyclicBarrier barrier = new CyclicBarrier(3, new Runnable() {
+ @Override public void run() {
+ try {
+ cmp.set(null);
- assertLatch = new CountDownLatch(1);
+ log.info("Checking cache content.");
- cmp = true;
+ assertCacheContent(expVals);
- killLock.lock();
+ log.info("Finished check cache content.");
+ }
+ catch (Throwable e) {
+ log.error("Unexpected error: " + e, e);
- try {
- if (!assertLatch.await(60_000, TimeUnit.MILLISECONDS))
- throw new IgniteCheckedException("Failed to suspend thread executing updates.");
+ throw e;
+ }
+ }
+ });
- log.info("Checking cache content.");
+ log.info("Start cache content check.");
- assertCacheContent(expVals);
+ cmp.set(barrier);
- nextAssert = System.currentTimeMillis() + ASSERT_FREQ;
- }
- finally {
- killLock.unlock();
+ barrier.await(60_000, TimeUnit.MILLISECONDS);
- updateLatch.countDown();
+ log.info("Cache content check done.");
- U.sleep(500);
- }
+ nextAssert = System.currentTimeMillis() + ASSERT_FREQ;
}
}
}
@@ -278,18 +347,17 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
updateFut.get();
log.info("Test finished. Update errors: " + errCntr.get());
-
}
/**
* @param stop Stop flag.
* @throws Exception If failed.
*/
- void killAndRestart(AtomicBoolean stop) throws Exception {
+ private void killAndRestart(AtomicBoolean stop) throws Exception {
if (stop.get())
return;
- int idx = random(1, gridCount() + 1);
+ int idx = random(1, GRID_CNT + 1);
log.info("Killing node " + idx);
@@ -309,10 +377,9 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCacheAbstra
/**
* @param expVals Expected values in cache.
- * @throws Exception If failed.
*/
@SuppressWarnings({"TooBroadScope", "ConstantIfStatement"})
- private void assertCacheContent(Map<Integer, GridTuple<Integer>> expVals) throws Exception {
+ private void assertCacheContent(Map<Integer, GridTuple<Integer>> expVals) {
assert !expVals.isEmpty();
Collection<Integer> failedKeys = new HashSet<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7490a6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
index c5c1c39..2f6ee8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
@@ -232,9 +232,15 @@ public class GridCacheMemoryModeSelfTest extends GridCommonAbstractTest {
//putAll
doTest(cache, offheapSwap, offheapEmpty, swapEmpty, new CIX1<IgniteCache<String, Integer>>() {
@Override public void applyx(IgniteCache<String, Integer> c) throws IgniteCheckedException {
+ putAll(c, 0, all / 2);
+
+ putAll(c, all / 2 + 1, all - 1);
+ }
+
+ private void putAll(IgniteCache<String, Integer> c, int k1, int k2) {
Map<String, Integer> m = new HashMap<>();
- for (int i = 0; i < all; i++)
+ for (int i = k1; i <= k2; i++)
m.put(valueOf(i), i);
c.putAll(m);
@@ -264,6 +270,7 @@ public class GridCacheMemoryModeSelfTest extends GridCommonAbstractTest {
assertEquals(offheapSwap, c.localSize(CachePeekMode.OFFHEAP) + c.localSize(CachePeekMode.SWAP));
info("size: " + c.size());
+ info("heap: " + c.localSize(CachePeekMode.ONHEAP));
info("offheap: " + c.localSize(CachePeekMode.OFFHEAP));
info("swap: " + c.localSize(CachePeekMode.SWAP));
[22/50] [abbrv] ignite git commit: Removed portable API information
from 1.4 release notes
Posted by sb...@apache.org.
Removed portable API information from 1.4 release notes
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/961a4671
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/961a4671
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/961a4671
Branch: refs/heads/ignite-1093-2
Commit: 961a46719b7de465ad7f263d106a4e9a7b926065
Parents: d39345b
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Sep 15 08:37:27 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Sep 15 08:37:27 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/961a4671/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 661ebe4..3f3ac7b 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -4,7 +4,6 @@ Apache Ignite Release Notes
Apache Ignite In-Memory Data Fabric 1.4
---------------------------------------
* Added SSL support to communication and discovery.
-* Added portable objects API.
* Added support for log4j2.
* Added versioned entry to cache API.
* Fixed IGNITE_HOME resolution with JBoss.
[04/50] [abbrv] ignite git commit: ignite-1462: hid portable API in
1.4 release
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java
deleted file mode 100644
index 3f8cd1c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java
+++ /dev/null
@@ -1,47 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractDataStreamerSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest extends
- GridCachePortableObjectsAbstractDataStreamerSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java
deleted file mode 100644
index a53a5ea..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +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.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest extends
- GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest {
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 4;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java
deleted file mode 100644
index 8f3a05f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java
+++ /dev/null
@@ -1,47 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractMultiThreadedSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest extends
- GridCachePortableObjectsAbstractMultiThreadedSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java
deleted file mode 100644
index ab6b0dd..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java
+++ /dev/null
@@ -1,36 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheMemoryModeSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Memory models test.
- */
-public class GridCacheMemoryModePortableSelfTest extends GridCacheMemoryModeSelfTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setMarshaller(new PortableMarshaller());
-
- return cfg;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java
deleted file mode 100644
index c845257..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java
+++ /dev/null
@@ -1,47 +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.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredAtomicSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredAtomicPortableSelfTest extends GridCacheOffHeapTieredAtomicSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean portableEnabled() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- // Enable portables.
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java
deleted file mode 100644
index 1a0d601..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java
+++ /dev/null
@@ -1,95 +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.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionAtomicSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredEvictionAtomicPortableSelfTest extends GridCacheOffHeapTieredEvictionAtomicSelfTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- // Enable portables.
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected TestPredicate testPredicate(String expVal, boolean acceptNull) {
- return new PortableValuePredicate(expVal, acceptNull);
- }
-
- /** {@inheritDoc} */
- @Override protected TestProcessor testClosure(String expVal, boolean acceptNull) {
- return new PortableValueClosure(expVal, acceptNull);
- }
-
- /**
- *
- */
- @SuppressWarnings("PackageVisibleInnerClass")
- static class PortableValuePredicate extends TestPredicate {
- /**
- * @param expVal Expected value.
- * @param acceptNull If {@code true} value can be null;
- */
- PortableValuePredicate(String expVal, boolean acceptNull) {
- super(expVal, acceptNull);
- }
-
- /** {@inheritDoc} */
- @Override public void checkValue(Object val) {
- PortableObject obj = (PortableObject)val;
-
- assertEquals(expVal, obj.field("val"));
- }
- }
-
- /**
- *
- */
- @SuppressWarnings("PackageVisibleInnerClass")
- static class PortableValueClosure extends TestProcessor {
- /**
- * @param expVal Expected value.
- * @param acceptNull If {@code true} value can be null;
- */
- PortableValueClosure(String expVal, boolean acceptNull) {
- super(expVal, acceptNull);
- }
-
- /** {@inheritDoc} */
- @Override public void checkValue(Object val) {
- PortableObject obj = (PortableObject)val;
-
- assertEquals(expVal, obj.field("val"));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java
deleted file mode 100644
index 60eed45..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java
+++ /dev/null
@@ -1,95 +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.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredEvictionPortableSelfTest extends GridCacheOffHeapTieredEvictionSelfTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- // Enable portables.
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected TestPredicate testPredicate(String expVal, boolean acceptNull) {
- return new PortableValuePredicate(expVal, acceptNull);
- }
-
- /** {@inheritDoc} */
- @Override protected TestProcessor testClosure(String expVal, boolean acceptNull) {
- return new PortableValueClosure(expVal, acceptNull);
- }
-
- /**
- *
- */
- @SuppressWarnings("PackageVisibleInnerClass")
- static class PortableValuePredicate extends TestPredicate {
- /**
- * @param expVal Expected value.
- * @param acceptNull If {@code true} value can be null;
- */
- PortableValuePredicate(String expVal, boolean acceptNull) {
- super(expVal, acceptNull);
- }
-
- /** {@inheritDoc} */
- @Override public void checkValue(Object val) {
- PortableObject obj = (PortableObject)val;
-
- assertEquals(expVal, obj.field("val"));
- }
- }
-
- /**
- *
- */
- @SuppressWarnings("PackageVisibleInnerClass")
- static class PortableValueClosure extends TestProcessor {
- /**
- * @param expVal Expected value.
- * @param acceptNull If {@code true} value can be null;
- */
- PortableValueClosure(String expVal, boolean acceptNull) {
- super(expVal, acceptNull);
- }
-
- /** {@inheritDoc} */
- @Override public void checkValue(Object val) {
- PortableObject obj = (PortableObject)val;
-
- assertEquals(expVal, obj.field("val"));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java
deleted file mode 100644
index 6170e39..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java
+++ /dev/null
@@ -1,47 +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.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredPortableSelfTest extends GridCacheOffHeapTieredSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean portableEnabled() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- // Enable portables.
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- PortableMarshaller marsh = new PortableMarshaller();
-
- marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java
deleted file mode 100644
index e6f7499..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java
+++ /dev/null
@@ -1,38 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.internal.processors.cache.portable.GridPortableDuplicateIndexObjectsAbstractSelfTest;
-
-/**
- * Test PARTITIONED ATOMIC.
- */
-public class GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest extends
- GridPortableDuplicateIndexObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override public CacheAtomicityMode atomicityMode() {
- return CacheAtomicityMode.ATOMIC;
- }
-
- /** {@inheritDoc} */
- @Override public CacheMode cacheMode() {
- return CacheMode.PARTITIONED;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java
deleted file mode 100644
index b5dc4e9..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java
+++ /dev/null
@@ -1,41 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.internal.processors.cache.portable.GridPortableDuplicateIndexObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test PARTITIONED and TRANSACTIONAL.
- */
-public class GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest extends
- GridPortableDuplicateIndexObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override public CacheAtomicityMode atomicityMode() {
- return TRANSACTIONAL;
- }
-
- /** {@inheritDoc} */
- @Override public CacheMode cacheMode() {
- return PARTITIONED;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java
deleted file mode 100644
index a5c28f3..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,29 +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.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest
- extends GridCachePortableObjectsAtomicNearDisabledSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean offheapTiered() {
- return true;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java
deleted file mode 100644
index 696c3ed..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java
+++ /dev/null
@@ -1,51 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsAtomicNearDisabledSelfTest extends GridCachePortableObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java
deleted file mode 100644
index 8e04fa1..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,29 +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.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsAtomicOffheapTieredSelfTest extends GridCachePortableObjectsAtomicSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean offheapTiered() {
- return true;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java
deleted file mode 100644
index 106e59b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java
+++ /dev/null
@@ -1,51 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsAtomicSelfTest extends GridCachePortableObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return new NearCacheConfiguration();
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java
deleted file mode 100644
index 5bc4672..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.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.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest
- extends GridCachePortableObjectsPartitionedNearDisabledSelfTest{
- /** {@inheritDoc} */
- @Override protected boolean offheapTiered() {
- return true;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java
deleted file mode 100644
index df55de7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java
+++ /dev/null
@@ -1,51 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsPartitionedNearDisabledSelfTest extends GridCachePortableObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return TRANSACTIONAL;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java
deleted file mode 100644
index a6bc0b4..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.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.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsPartitionedOffheapTieredSelfTest
- extends GridCachePortableObjectsPartitionedSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean offheapTiered() {
- return true;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java
deleted file mode 100644
index 8c248be..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java
+++ /dev/null
@@ -1,51 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsPartitionedSelfTest extends GridCachePortableObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return TRANSACTIONAL;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return new NearCacheConfiguration();
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java
deleted file mode 100644
index d984756..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java
+++ /dev/null
@@ -1,41 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAbstractNearPartitionedByteArrayValuesSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCachePortablesNearPartitionedByteArrayValuesSelfTest
- extends GridCacheAbstractNearPartitionedByteArrayValuesSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean peerClassLoading() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setMarshaller(new PortableMarshaller());
-
- return cfg;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java
deleted file mode 100644
index 5830b12..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java
+++ /dev/null
@@ -1,42 +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.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest
- extends GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean peerClassLoading() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setMarshaller(new PortableMarshaller());
-
- return cfg;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java
deleted file mode 100644
index 953fbfa..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java
+++ /dev/null
@@ -1,51 +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.processors.cache.portable.distributed.replicated;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsReplicatedSelfTest extends GridCachePortableObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return REPLICATED;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return TRANSACTIONAL;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java
deleted file mode 100644
index 3f3a350..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java
+++ /dev/null
@@ -1,32 +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.processors.cache.portable.local;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-
-/**
- *
- */
-public class GridCachePortableObjectsAtomicLocalSelfTest extends GridCachePortableObjectsLocalSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java
deleted file mode 100644
index 53713ce..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,29 +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.processors.cache.portable.local;
-
-/**
- *
- */
-public class GridCachePortableObjectsLocalOffheapTieredSelfTest extends GridCachePortableObjectsLocalSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean offheapTiered() {
- return true;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java
deleted file mode 100644
index 1a87865..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java
+++ /dev/null
@@ -1,51 +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.processors.cache.portable.local;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.LOCAL;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsLocalSelfTest extends GridCachePortableObjectsAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return LOCAL;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return TRANSACTIONAL;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 1;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index 1e4c828..964753d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -35,7 +35,6 @@ import org.apache.ignite.IgniteEvents;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteScheduler;
import org.apache.ignite.IgniteServices;
@@ -271,11 +270,6 @@ public class IgniteMock implements Ignite {
}
/** {@inheritDoc} */
- @Override public IgnitePortables portables() {
- return null;
- }
-
- /** {@inheritDoc} */
@Override public void close() {}
@Nullable @Override public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) {
@@ -339,4 +333,4 @@ public class IgniteMock implements Ignite {
public void setStaticCfg(IgniteConfiguration staticCfg) {
this.staticCfg = staticCfg;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index 2b448f8..dfbb0ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -153,11 +153,6 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
- @Override public <K1, V1> IgniteCache<K1, V1> withKeepPortable() {
- throw new UnsupportedOperationException("Method should be supported.");
- }
-
- /** {@inheritDoc} */
@Override public void loadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) throws CacheException {
throw new UnsupportedOperationException("Method should be supported.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 3522407..ec7dab7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -41,7 +41,7 @@ import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.IgniteIllegalStateException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteScheduler;
import org.apache.ignite.IgniteServices;
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java
deleted file mode 100644
index d7dda61..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java
+++ /dev/null
@@ -1,37 +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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- * Cache full API suite with portable marshaller.
- */
-public class IgnitePortableCacheFullApiTestSuite extends TestSuite {
- /**
- * @return Suite.
- * @throws Exception In case of error.
- */
- public static TestSuite suite() throws Exception {
- GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, PortableMarshaller.class.getName());
-
- return IgniteCacheFullApiSelfTestSuite.suite();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java
deleted file mode 100644
index db20e48..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java
+++ /dev/null
@@ -1,103 +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.testsuites;
-
-import java.util.HashSet;
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheMvccSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.expiry.IgniteCacheAtomicLocalExpiryPolicyTest;
-import org.apache.ignite.internal.processors.cache.expiry.IgniteCacheExpiryPolicyTestSuite;
-import org.apache.ignite.internal.processors.cache.portable.GridPortableCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.datastreaming.DataStreamProcessorPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.datastreaming.GridDataStreamerImplSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAffinityRoutingPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheMemoryModePortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredAtomicPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredEvictionAtomicPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredEvictionPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortablesNearPartitionedByteArrayValuesSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest;
-import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- * Cache suite with portable marshaller.
- */
-public class IgnitePortableCacheTestSuite extends TestSuite {
- /**
- * @return Suite.
- * @throws Exception In case of error.
- */
- public static TestSuite suite() throws Exception {
- GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, PortableMarshaller.class.getName());
-
- TestSuite suite = new TestSuite("Portable Cache Test Suite");
-
- HashSet<Class> ignoredTests = new HashSet<>();
-
- // Tests below have a special version for Portable Marshaller
- ignoredTests.add(DataStreamProcessorSelfTest.class);
- ignoredTests.add(GridCacheOffHeapTieredEvictionAtomicSelfTest.class);
- ignoredTests.add(GridCacheOffHeapTieredEvictionSelfTest.class);
- ignoredTests.add(GridCacheOffHeapTieredSelfTest.class);
- ignoredTests.add(GridCacheOffHeapTieredAtomicSelfTest.class);
- ignoredTests.add(GridCacheAffinityRoutingSelfTest.class);
- ignoredTests.add(IgniteCacheAtomicLocalExpiryPolicyTest.class);
- ignoredTests.add(GridCacheEntryMemorySizeSelfTest.class);
-
- // Tests that are not ready to be used with PortableMarshaller
- ignoredTests.add(GridCacheMvccSelfTest.class);
-
- suite.addTest(IgniteCacheTestSuite.suite(ignoredTests));
- suite.addTest(IgniteCacheExpiryPolicyTestSuite.suite());
-
- suite.addTestSuite(GridCacheMemoryModePortableSelfTest.class);
- suite.addTestSuite(GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.class);
- suite.addTestSuite(GridCacheOffHeapTieredEvictionPortableSelfTest.class);
-
- suite.addTestSuite(GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.class);
- suite.addTestSuite(GridCachePortablesNearPartitionedByteArrayValuesSelfTest.class);
- suite.addTestSuite(GridCacheOffHeapTieredPortableSelfTest.class);
- suite.addTestSuite(GridCacheOffHeapTieredAtomicPortableSelfTest.class);
-
- suite.addTestSuite(GridDataStreamerImplSelfTest.class);
- suite.addTestSuite(DataStreamProcessorPortableSelfTest.class);
- suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.class);
- suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.class);
-
- suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.class);
- suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.class);
-
- suite.addTestSuite(GridCacheAffinityRoutingPortableSelfTest.class);
- suite.addTestSuite(GridPortableCacheEntryMemorySizeSelfTest.class);
-
- return suite;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
deleted file mode 100644
index ecd25e1..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ /dev/null
@@ -1,92 +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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.portable.GridPortableAffinityKeySelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderAdditionalSelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderSelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderStringAsCharsAdditionalSelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderStringAsCharsSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMarshallerCtxDisabledSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMarshallerSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMetaDataDisabledSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMetaDataSelfTest;
-import org.apache.ignite.internal.portable.GridPortableWildcardsSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodePortableMetadataMultinodeTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodePortableMetadataTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableStoreObjectsSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableStorePortablesSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicNearDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedNearDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.replicated.GridCachePortableObjectsReplicatedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.local.GridCachePortableObjectsAtomicLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.local.GridCachePortableObjectsLocalOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.local.GridCachePortableObjectsLocalSelfTest;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class IgnitePortableObjectsTestSuite extends TestSuite {
- /**
- * @return Suite.
- * @throws Exception If failed.
- */
- public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("GridGain Portable Objects Test Suite");
-
- suite.addTestSuite(GridPortableMarshallerSelfTest.class);
- suite.addTestSuite(GridPortableMarshallerCtxDisabledSelfTest.class);
- suite.addTestSuite(GridPortableBuilderSelfTest.class);
- suite.addTestSuite(GridPortableBuilderStringAsCharsSelfTest.class);
- suite.addTestSuite(GridPortableMetaDataSelfTest.class);
- suite.addTestSuite(GridPortableMetaDataDisabledSelfTest.class);
- suite.addTestSuite(GridPortableAffinityKeySelfTest.class);
- suite.addTestSuite(GridPortableWildcardsSelfTest.class);
- suite.addTestSuite(GridPortableBuilderAdditionalSelfTest.class);
- suite.addTestSuite(GridPortableBuilderStringAsCharsAdditionalSelfTest.class);
-
- suite.addTestSuite(GridCachePortableObjectsLocalSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsAtomicLocalSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsReplicatedSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsPartitionedSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsPartitionedNearDisabledSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsAtomicSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsAtomicNearDisabledSelfTest.class);
-
- suite.addTestSuite(GridCachePortableObjectsLocalOffheapTieredSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsAtomicOffheapTieredSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsPartitionedOffheapTieredSelfTest.class);
- suite.addTestSuite(GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.class);
-
- suite.addTestSuite(GridCachePortableStoreObjectsSelfTest.class);
- suite.addTestSuite(GridCachePortableStorePortablesSelfTest.class);
-
- suite.addTestSuite(GridCacheClientNodePortableMetadataTest.class);
- suite.addTestSuite(GridCacheClientNodePortableMetadataMultinodeTest.class);
-
- return suite;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar
deleted file mode 100644
index 863350d..0000000
Binary files a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom
deleted file mode 100644
index c79dfbf..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.ignite.portable</groupId>
- <artifactId>test1</artifactId>
- <version>1.1</version>
- <description>POM was created from install:install-file</description>
-</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml
deleted file mode 100644
index 33f5abf..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
- <groupId>org.apache.ignite.portable</groupId>
- <artifactId>test1</artifactId>
- <versioning>
- <release>1.1</release>
- <versions>
- <version>1.1</version>
- </versions>
- <lastUpdated>20140806090184</lastUpdated>
- </versioning>
-</metadata>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar
deleted file mode 100644
index ccf4ea2..0000000
Binary files a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom
deleted file mode 100644
index 37621e1..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.ignite.portable</groupId>
- <artifactId>test2</artifactId>
- <version>1.1</version>
- <description>POM was created from install:install-file</description>
-</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml
deleted file mode 100644
index 9c705ef..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
- <groupId>org.apache.ignite.portable</groupId>
- <artifactId>test2</artifactId>
- <versioning>
- <release>1.1</release>
- <versions>
- <version>1.1</version>
- </versions>
- <lastUpdated>20140806090410</lastUpdated>
- </versioning>
-</metadata>
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
index 2bdf28c..833e49e 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.IgniteClusterEx;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.igfs.IgfsBlockLocationImpl;
@@ -1024,5 +1025,10 @@ public class HadoopDefaultMapReducePlannerSelfTest extends HadoopAbstractSelfTes
@Override public GridKernalContext context() {
return null;
}
+
+ /** {@inheritDoc} */
+ @Override public IgnitePortables portables() {
+ return null;
+ }
}
}
\ No newline at end of file
[40/50] [abbrv] ignite git commit: Hadoop: commented out external
execution tests.
Posted by sb...@apache.org.
Hadoop: commented out external execution tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2aa292c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2aa292c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2aa292c4
Branch: refs/heads/ignite-1093-2
Commit: 2aa292c47b87c0099d6d602dc282c231cd408f2b
Parents: 3f75c1c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 15:42:42 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 15:42:42 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/testsuites/IgniteHadoopTestSuite.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2aa292c4/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
index 0b3ff22..23f85d2 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
@@ -151,9 +151,9 @@ public class IgniteHadoopTestSuite extends TestSuite {
suite.addTest(new TestSuite(ldr.loadClass(HadoopSortingTest.class.getName())));
- suite.addTest(new TestSuite(ldr.loadClass(HadoopExternalTaskExecutionSelfTest.class.getName())));
- suite.addTest(new TestSuite(ldr.loadClass(HadoopExternalCommunicationSelfTest.class.getName())));
- suite.addTest(new TestSuite(ldr.loadClass(HadoopSortingExternalTest.class.getName())));
+// suite.addTest(new TestSuite(ldr.loadClass(HadoopExternalTaskExecutionSelfTest.class.getName())));
+// suite.addTest(new TestSuite(ldr.loadClass(HadoopExternalCommunicationSelfTest.class.getName())));
+// suite.addTest(new TestSuite(ldr.loadClass(HadoopSortingExternalTest.class.getName())));
suite.addTest(new TestSuite(ldr.loadClass(HadoopGroupingTest.class.getName())));
[02/50] [abbrv] ignite git commit: IGNITE-1479 Platform .Net: NPE in
PlatformAbstractService upon service cancellation
Posted by sb...@apache.org.
IGNITE-1479 Platform .Net: NPE in PlatformAbstractService upon service cancellation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a0cd9afd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a0cd9afd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a0cd9afd
Branch: refs/heads/ignite-1093-2
Commit: a0cd9afd1cbf471ced0363416f4577156a7296ea
Parents: b4c515e
Author: ptupitsyn <pt...@gridgain.com>
Authored: Mon Sep 14 17:23:16 2015 +0300
Committer: ptupitsyn <pt...@gridgain.com>
Committed: Mon Sep 14 17:23:16 2015 +0300
----------------------------------------------------------------------
.../processors/platform/services/PlatformAbstractService.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0cd9afd/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
index dac3ea2..dd5c28a 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
@@ -212,7 +212,9 @@ public abstract class PlatformAbstractService implements PlatformService, Extern
@SuppressWarnings("UnusedDeclaration")
@IgniteInstanceResource
public void setIgniteInstance(Ignite ignite) {
- platformCtx = PlatformUtils.platformContext(ignite);
+ platformCtx = ignite != null
+ ? PlatformUtils.platformContext(ignite)
+ : null;
}
/** {@inheritDoc} */
[18/50] [abbrv] ignite git commit: IGNITE-1197 - Fixed unswap iterator
Posted by sb...@apache.org.
IGNITE-1197 - Fixed unswap iterator
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cb9b7662
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cb9b7662
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cb9b7662
Branch: refs/heads/ignite-1093-2
Commit: cb9b76620167cc8b71b333615e6406dd98dc6d7a
Parents: 866fb41
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Sep 14 16:34:28 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 16:36:04 2015 -0700
----------------------------------------------------------------------
.../distributed/dht/GridDhtLocalPartition.java | 63 ++++++++++++++------
1 file changed, 44 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cb9b7662/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 215a1b5..a58451f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -707,38 +708,62 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
return new Iterator<GridDhtCacheEntry>() {
/** */
- GridDhtCacheEntry lastEntry;
+ private GridDhtCacheEntry lastEntry;
- @Override public boolean hasNext() {
- return it.hasNext();
+ {
+ lastEntry = advance();
}
- @Override public GridDhtCacheEntry next() {
- Map.Entry<byte[], GridCacheSwapEntry> entry = it.next();
+ private GridDhtCacheEntry advance() {
+ if (it.hasNext()) {
+ Map.Entry<byte[], GridCacheSwapEntry> entry = it.next();
- byte[] keyBytes = entry.getKey();
+ byte[] keyBytes = entry.getKey();
- while (true) {
- try {
- KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
+ while (true) {
+ try {
+ KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
- lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
+ lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
- lastEntry.unswap(true);
+ lastEntry.unswap(true);
- return lastEntry;
- }
- catch (GridCacheEntryRemovedException e) {
- if (log.isDebugEnabled())
- log.debug("Got removed entry: " + lastEntry);
- }
- catch (IgniteCheckedException e) {
- throw new CacheException(e);
+ return lastEntry;
+ }
+ catch (GridCacheEntryRemovedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Got removed entry: " + lastEntry);
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ catch (GridDhtInvalidPartitionException e) {
+ if (log.isDebugEnabled())
+ log.debug("Got invalid partition exception: " + e);
+
+ return null;
+ }
}
}
+
+ return null;
+ }
+
+ @Override public boolean hasNext() {
+ return lastEntry != null;
+ }
+
+ @Override public GridDhtCacheEntry next() {
+ if (lastEntry == null)
+ throw new NoSuchElementException();
+
+ return lastEntry;
}
@Override public void remove() {
+ if (lastEntry == null)
+ throw new NoSuchElementException();
+
map.remove(lastEntry.key(), lastEntry);
}
};
[16/50] [abbrv] ignite git commit: IGNITE-1090 - Fixed backup check
for one-phase commit transaction.
Posted by sb...@apache.org.
IGNITE-1090 - Fixed backup check for one-phase commit transaction.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/06fdd7d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/06fdd7d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/06fdd7d4
Branch: refs/heads/ignite-1093-2
Commit: 06fdd7d44dda36900b4c7a76dec2a7848ca9e8fb
Parents: e5f1681
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 13:35:41 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 13:35:41 2015 -0700
----------------------------------------------------------------------
.../near/GridNearTxFinishFuture.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/06fdd7d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index ddc8be5..21aaef2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -396,20 +396,24 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
ClusterNode backup = cctx.discovery().node(backupId);
- // Nothing to do if backup has left the grid.
- if (backup == null)
- return;
-
MiniFuture mini = new MiniFuture(backup, mapping);
add(mini);
- if (backup.isLocal()) {
- if (cctx.tm().txHandler().checkDhtRemoteTxCommitted(tx.xidVersion())) {
- readyNearMappingFromBackup(mapping);
+ // Nothing to do if backup has left the grid.
+ if (backup == null) {
+ readyNearMappingFromBackup(mapping);
+ mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
+ "(backup has left grid): " + tx.xidVersion()));
+ }
+ else if (backup.isLocal()) {
+ boolean committed = cctx.tm().txHandler().checkDhtRemoteTxCommitted(tx.xidVersion());
+
+ readyNearMappingFromBackup(mapping);
+
+ if (committed)
mini.onDone(tx);
- }
else
mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
"(transaction has been rolled back on backup node): " + tx.xidVersion()));