You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/18 09:08:10 UTC
[01/50] [abbrv] ignite git commit: Ignite-1093 Backward compatibility
failover.
Repository: ignite
Updated Branches:
refs/heads/ignite-1816 ff38ae943 -> 6a0243040
Ignite-1093 Backward compatibility failover.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6ea3b5cb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6ea3b5cb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6ea3b5cb
Branch: refs/heads/ignite-1816
Commit: 6ea3b5cbcdfb97ca07e290924068f692a52679fd
Parents: 4ab2bd3
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 9 15:09:36 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 9 19:04:52 2015 +0300
----------------------------------------------------------------------
.../distributed/dht/preloader/GridDhtPartitionDemander.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6ea3b5cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 35cedf9..29ca5f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -1191,7 +1191,7 @@ public class GridDhtPartitionDemander {
// While.
// =====
- while (!topologyChanged(fut)) {
+ while (!fut.isDone() && !topologyChanged(fut)) {
SupplyMessage s = poll(msgQ, timeout);
// If timed out.
@@ -1350,7 +1350,7 @@ public class GridDhtPartitionDemander {
}
}
}
- while (retry && !topologyChanged(fut));
+ while (retry && !fut.isDone() && !topologyChanged(fut));
}
finally {
cctx.io().removeOrderedHandler(d.topic());
[31/50] [abbrv] ignite git commit: Merge branch ignite-1.5 into
ignite-1282
Posted by vo...@apache.org.
Merge branch ignite-1.5 into ignite-1282
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b278fe3e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b278fe3e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b278fe3e
Branch: refs/heads/ignite-1816
Commit: b278fe3e357badcb26e78891d9edb5f31def512c
Parents: 0ccba79
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Nov 17 13:35:26 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 17 13:35:26 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/preloader/GridDhtPartitionDemander.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b278fe3e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 40d3dc1..7ccb68e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -688,7 +688,7 @@ public class GridDhtPartitionDemander {
if (cctx.events().isRecordable(EVT_CACHE_REBALANCE_OBJECT_LOADED) && !cached.isInternal())
cctx.events().addEvent(cached.partition(), cached.key(), cctx.localNodeId(),
(IgniteUuid)null, null, EVT_CACHE_REBALANCE_OBJECT_LOADED, entry.value(), true, null,
- false, null, null, null);
+ false, null, null, null, true);
}
else if (log.isDebugEnabled())
log.debug("Rebalancing entry is already in cache (will ignore) [key=" + cached.key() +
[25/50] [abbrv] ignite git commit: IGNITE-1890 Fixed Visor Console
log command help.
Posted by vo...@apache.org.
IGNITE-1890 Fixed Visor Console log command help.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7a403644
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7a403644
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7a403644
Branch: refs/heads/ignite-1816
Commit: 7a403644b60771b2bb76238f1c6d955bea9a608a
Parents: 5887ae4
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 13 16:59:27 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 13 16:59:27 2015 +0700
----------------------------------------------------------------------
.../src/main/scala/org/apache/ignite/visor/visor.scala | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a403644/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index 28ef0d7..986089b 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -507,8 +507,7 @@ object visor extends VisorTag {
"If logging is already stopped - it's no-op."
),
"-dl" -> Seq(
- "Disables collecting of job and task fail events, licence violation events, cache rebalance events" +
- " from remote nodes."
+ "Disables collecting of job and task fail events, cache rebalance events from remote nodes."
)
),
examples = Seq(
[47/50] [abbrv] ignite git commit: IGNITE-1847: Added "field" method
to BinaryType and reworked internal metadata handling.
Posted by vo...@apache.org.
IGNITE-1847: Added "field" method to BinaryType and reworked internal metadata handling.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/63d55062
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/63d55062
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/63d55062
Branch: refs/heads/ignite-1816
Commit: 63d55062790f481f104bd03eaf53c75473233e56
Parents: f3b0be7
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Nov 18 10:24:15 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 18 10:24:15 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/binary/BinaryObject.java | 9 -
.../org/apache/ignite/binary/BinaryType.java | 11 +-
.../internal/portable/BinaryFieldImpl.java | 14 +-
.../portable/BinaryMetaDataCollector.java | 99 +++--
.../internal/portable/BinaryMetaDataImpl.java | 150 --------
.../internal/portable/BinaryMetadata.java | 152 ++++++++
.../portable/BinaryMetadataHandler.java | 44 +++
.../portable/BinaryNoopMetadataHandler.java | 53 +++
.../internal/portable/BinaryObjectEx.java | 4 +-
.../internal/portable/BinaryObjectImpl.java | 13 -
.../portable/BinaryObjectOffheapImpl.java | 13 -
.../internal/portable/BinaryTypeImpl.java | 75 ++++
.../portable/PortableClassDescriptor.java | 169 +++++----
.../internal/portable/PortableContext.java | 39 +-
.../portable/PortableMetaDataHandler.java | 44 ---
.../ignite/internal/portable/PortableUtils.java | 104 +++++-
.../builder/BinaryObjectBuilderImpl.java | 32 +-
.../portable/builder/PortableValueWithType.java | 9 +-
.../CacheObjectBinaryProcessorImpl.java | 360 +++++++------------
.../cache/portable/PortableMetaDataKey.java | 10 +-
.../platform/PlatformContextImpl.java | 10 +-
.../PlatformDotNetConfigurationClosure.java | 19 +-
.../processors/query/GridQueryProcessor.java | 2 +-
.../portable/BinaryFieldsAbstractSelfTest.java | 24 +-
...idBinaryObjectBuilderAdditionalSelfTest.java | 2 +-
.../GridBinaryObjectBuilderSelfTest.java | 4 +-
...idPortableMarshallerCtxDisabledSelfTest.java | 33 +-
.../GridPortableMarshallerSelfTest.java | 13 +-
.../portable/GridPortableMetaDataSelfTest.java | 12 +-
.../portable/GridPortableWildcardsSelfTest.java | 23 +-
.../PortableCompactOffsetsAbstractSelfTest.java | 21 +-
.../portable/TestCachingMetadataHandler.java | 45 +++
...ntNodeBinaryObjectMetadataMultinodeTest.java | 4 +-
...CacheClientNodeBinaryObjectMetadataTest.java | 5 +-
...ridPortableCacheEntryMemorySizeSelfTest.java | 14 +-
.../PlatformComputeBinarizableArgTask.java | 2 +-
36 files changed, 840 insertions(+), 797 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
index f48f350..9481618 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
@@ -137,15 +137,6 @@ public interface BinaryObject extends Serializable, Cloneable {
public boolean hasField(String fieldName);
/**
- * Gets field descriptor.
- *
- * @param fieldName Field name.
- * @return Field descriptor.
- * @throws BinaryObjectException If failed.
- */
- public BinaryField fieldDescriptor(String fieldName) throws BinaryObjectException;
-
- /**
* Gets fully deserialized instance of binary object.
*
* @return Fully deserialized instance of binary object.
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
index d149fd4..52bb212 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
@@ -38,7 +38,7 @@ public interface BinaryType {
*
* @return Collection of all field names for this binary type.
*/
- public Collection<String> fields();
+ public Collection<String> fieldNames();
/**
* Gets name of the field type for a given field.
@@ -49,6 +49,15 @@ public interface BinaryType {
public String fieldTypeName(String fieldName);
/**
+ * Get {@link BinaryField} for the given field name. Later this field can be used for fast field's value
+ * retrieval from concrete {@link BinaryObject}.
+ *
+ * @param fieldName Field name.
+ * @return Binary field.
+ */
+ public BinaryField field(String fieldName);
+
+ /**
* Binary 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.
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldImpl.java
index b8a25c1..810c820 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryFieldImpl.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.portable;
+import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.binary.BinaryObject;
@@ -26,6 +27,9 @@ import org.apache.ignite.binary.BinaryField;
* Implementation of portable field descriptor.
*/
public class BinaryFieldImpl implements BinaryField {
+ /** Type ID. */
+ private final int typeId;
+
/** Well-known object schemas. */
@GridToStringExclude
private final PortableSchemaRegistry schemas;
@@ -43,11 +47,13 @@ public class BinaryFieldImpl implements BinaryField {
* @param fieldName Field name.
* @param fieldId Field ID.
*/
- public BinaryFieldImpl(PortableSchemaRegistry schemas, String fieldName, int fieldId) {
+ public BinaryFieldImpl(int typeId, PortableSchemaRegistry schemas, String fieldName, int fieldId) {
+ assert typeId != 0;
assert schemas != null;
assert fieldName != null;
assert fieldId != 0;
+ this.typeId = typeId;
this.schemas = schemas;
this.fieldName = fieldName;
this.fieldId = fieldId;
@@ -82,6 +88,12 @@ public class BinaryFieldImpl implements BinaryField {
* @return Field offset.
*/
private int fieldOrder(BinaryObjectEx obj) {
+ if (typeId != obj.typeId()) {
+ throw new BinaryObjectException("Failed to get field because type ID of passed object differs" +
+ " from type ID this " + BinaryField.class.getSimpleName() + " belongs to [expected=" + typeId +
+ ", actual=" + obj.typeId() + ']');
+ }
+
int schemaId = obj.schemaId();
PortableSchema schema = schemas.schema(schemaId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
index b053a55..67e1a0d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
@@ -35,9 +35,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Writer for meta data collection.
*/
-class BinaryMetaDataCollector implements BinaryWriter {
+class BinaryMetadataCollector implements BinaryWriter {
/** */
- private final Map<String, String> meta = new HashMap<>();
+ private final Map<String, Integer> meta = new HashMap<>();
/** */
private final String typeName;
@@ -45,176 +45,176 @@ class BinaryMetaDataCollector implements BinaryWriter {
/**
* @param typeName Type name.
*/
- BinaryMetaDataCollector(String typeName) {
+ BinaryMetadataCollector(String typeName) {
this.typeName = typeName;
}
/**
* @return Field meta data.
*/
- Map<String, String> meta() {
+ Map<String, Integer> meta() {
return meta;
}
/** {@inheritDoc} */
@Override public void writeByte(String fieldName, byte val) throws BinaryObjectException {
- add(fieldName, byte.class);
+ add(fieldName, PortableClassDescriptor.Mode.BYTE);
}
/** {@inheritDoc} */
@Override public void writeShort(String fieldName, short val) throws BinaryObjectException {
- add(fieldName, short.class);
+ add(fieldName, PortableClassDescriptor.Mode.SHORT);
}
/** {@inheritDoc} */
@Override public void writeInt(String fieldName, int val) throws BinaryObjectException {
- add(fieldName, int.class);
+ add(fieldName, PortableClassDescriptor.Mode.INT);
}
/** {@inheritDoc} */
@Override public void writeLong(String fieldName, long val) throws BinaryObjectException {
- add(fieldName, long.class);
+ add(fieldName, PortableClassDescriptor.Mode.LONG);
}
/** {@inheritDoc} */
@Override public void writeFloat(String fieldName, float val) throws BinaryObjectException {
- add(fieldName, float.class);
+ add(fieldName, PortableClassDescriptor.Mode.FLOAT);
}
/** {@inheritDoc} */
@Override public void writeDouble(String fieldName, double val) throws BinaryObjectException {
- add(fieldName, double.class);
+ add(fieldName, PortableClassDescriptor.Mode.DOUBLE);
}
/** {@inheritDoc} */
@Override public void writeChar(String fieldName, char val) throws BinaryObjectException {
- add(fieldName, char.class);
+ add(fieldName, PortableClassDescriptor.Mode.CHAR);
}
/** {@inheritDoc} */
@Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException {
- add(fieldName, boolean.class);
+ add(fieldName, PortableClassDescriptor.Mode.BOOLEAN);
}
/** {@inheritDoc} */
@Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DECIMAL.typeName());
+ add(fieldName, PortableClassDescriptor.Mode.DECIMAL);
}
/** {@inheritDoc} */
@Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException {
- add(fieldName, String.class);
+ add(fieldName, PortableClassDescriptor.Mode.STRING);
}
/** {@inheritDoc} */
@Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException {
- add(fieldName, UUID.class);
+ add(fieldName, PortableClassDescriptor.Mode.UUID);
}
/** {@inheritDoc} */
@Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException {
- add(fieldName, Date.class);
+ add(fieldName, PortableClassDescriptor.Mode.DATE);
}
/** {@inheritDoc} */
@Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException {
- add(fieldName, Timestamp.class);
+ add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP);
}
/** {@inheritDoc} */
@Override public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws BinaryObjectException {
- add(fieldName, Enum.class);
+ add(fieldName, PortableClassDescriptor.Mode.ENUM);
}
/** {@inheritDoc} */
@Override public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException {
- add(fieldName, Enum[].class);
+ add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR);
}
/** {@inheritDoc} */
@Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException {
- add(fieldName, Object.class);
+ add(fieldName, PortableClassDescriptor.Mode.OBJECT);
}
/** {@inheritDoc} */
@Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException {
- add(fieldName, byte[].class);
+ add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR);
}
/** {@inheritDoc} */
@Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException {
- add(fieldName, short[].class);
+ add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR);
}
/** {@inheritDoc} */
@Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException {
- add(fieldName, int[].class);
+ add(fieldName, PortableClassDescriptor.Mode.INT_ARR);
}
/** {@inheritDoc} */
@Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException {
- add(fieldName, long[].class);
+ add(fieldName, PortableClassDescriptor.Mode.LONG_ARR);
}
/** {@inheritDoc} */
@Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException {
- add(fieldName, float[].class);
+ add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR);
}
/** {@inheritDoc} */
@Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException {
- add(fieldName, double[].class);
+ add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR);
}
/** {@inheritDoc} */
@Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException {
- add(fieldName, char[].class);
+ add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR);
}
/** {@inheritDoc} */
@Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException {
- add(fieldName, boolean[].class);
+ add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR);
}
/** {@inheritDoc} */
@Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR.typeName());
+ add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR);
}
/** {@inheritDoc} */
@Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException {
- add(fieldName, String[].class);
+ add(fieldName, PortableClassDescriptor.Mode.STRING_ARR);
}
/** {@inheritDoc} */
@Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException {
- add(fieldName, UUID[].class);
+ add(fieldName, PortableClassDescriptor.Mode.UUID_ARR);
}
/** {@inheritDoc} */
@Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException {
- add(fieldName, Date[].class);
+ add(fieldName, PortableClassDescriptor.Mode.DATE_ARR);
}
/** {@inheritDoc} */
@Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException {
- add(fieldName, Timestamp[].class);
+ add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR);
}
/** {@inheritDoc} */
@Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException {
- add(fieldName, Object[].class);
+ add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR);
}
/** {@inheritDoc} */
@Override public <T> void writeCollection(String fieldName, @Nullable Collection<T> col)
throws BinaryObjectException {
- add(fieldName, Collection.class);
+ add(fieldName, PortableClassDescriptor.Mode.COL);
}
/** {@inheritDoc} */
@Override public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws BinaryObjectException {
- add(fieldName, Map.class);
+ add(fieldName, PortableClassDescriptor.Mode.MAP);
}
/** {@inheritDoc} */
@@ -230,32 +230,23 @@ class BinaryMetaDataCollector implements BinaryWriter {
/**
* @param name Field name.
- * @param fieldType Field type.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ * @param mode Field mode.
+ * @throws BinaryObjectException In case of error.
*/
- private void add(String name, Class<?> fieldType) throws BinaryObjectException {
- assert fieldType != null;
-
- add(name, fieldType.getSimpleName());
- }
-
- /**
- * @param name Field name.
- * @param fieldTypeName Field type name.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
- */
- private void add(String name, String fieldTypeName) throws BinaryObjectException {
+ private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException {
assert name != null;
- String oldFieldTypeName = meta.put(name, fieldTypeName);
+ int fieldTypeId = mode.typeId();
+
+ Integer oldFieldTypeId = meta.put(name, fieldTypeId);
- if (oldFieldTypeName != null && !oldFieldTypeName.equals(fieldTypeName)) {
+ if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) {
throw new BinaryObjectException(
"Field is written twice with different types [" +
"typeName=" + typeName +
", fieldName=" + name +
- ", fieldTypeName1=" + oldFieldTypeName +
- ", fieldTypeName2=" + fieldTypeName +
+ ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) +
+ ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) +
']'
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
deleted file mode 100644
index 18f538b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
+++ /dev/null
@@ -1,150 +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.Collection;
-import java.util.Collections;
-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.binary.BinaryObjectException;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable meta data implementation.
- */
-public class BinaryMetaDataImpl implements BinaryType, Binarylizable, Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private String typeName;
-
- /** */
- @GridToStringInclude
- private Map<String, String> fields;
-
- /** */
- private volatile Map<Integer, String> fldIdToName;
-
- /** */
- private String affKeyFieldName;
-
- /**
- * For {@link Externalizable}.
- */
- public BinaryMetaDataImpl() {
- // No-op.
- }
-
- /**
- * @param typeName Type name.
- * @param fields Fields map.
- * @param affKeyFieldName Affinity key field name.
- */
- public BinaryMetaDataImpl(String typeName, @Nullable Map<String, String> fields,
- @Nullable String affKeyFieldName) {
- assert typeName != null;
-
- this.typeName = typeName;
- this.fields = fields;
- this.affKeyFieldName = affKeyFieldName;
- }
-
- /** {@inheritDoc} */
- @Override public String typeName() {
- return typeName;
- }
-
- /** {@inheritDoc} */
- @Override public Collection<String> fields() {
- return fields != null ? fields.keySet() : Collections.<String>emptyList();
- }
-
- /**
- * @return Fields.
- */
- public Map<String, String> fields0() {
- return fields != null ? fields : Collections.<String, String>emptyMap();
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public String fieldTypeName(String fieldName) {
- return fields != null ? fields.get(fieldName) : null;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public String affinityKeyFieldName() {
- return affKeyFieldName;
- }
-
- /**
- * @return Fields meta data.
- */
- public Map<String, String> fieldsMeta() {
- return fields != null ? fields : Collections.<String, String>emptyMap();
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeString(out, typeName);
- U.writeMap(out, fields);
- U.writeString(out, affKeyFieldName);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- typeName = U.readString(in);
- fields = U.readMap(in);
- affKeyFieldName = U.readString(in);
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- BinaryRawWriter raw = writer.rawWriter();
-
- raw.writeString(typeName);
- raw.writeString(affKeyFieldName);
- raw.writeMap(fields);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- BinaryRawReader raw = reader.rawReader();
-
- typeName = raw.readString();
- affKeyFieldName = raw.readString();
- fields = raw.readMap();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(BinaryMetaDataImpl.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
new file mode 100644
index 0000000..fe88d11
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.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;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collection;
+import java.util.Collections;
+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.jetbrains.annotations.Nullable;
+
+/**
+ * Portable metadata which is passed over a wire.
+ */
+public class BinaryMetadata implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Type ID. */
+ private int typeId;
+
+ /** Type name. */
+ private String typeName;
+
+ /** Recorded object fields. */
+ @GridToStringInclude
+ private Map<String, Integer> fields;
+
+ /** Affinity key field name. */
+ private String affKeyFieldName;
+
+ /**
+ * For {@link Externalizable}.
+ */
+ public BinaryMetadata() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param typeId Type ID.
+ * @param typeName Type name.
+ * @param fields Fields map.
+ * @param affKeyFieldName Affinity key field name.
+ */
+ public BinaryMetadata(int typeId, String typeName, @Nullable Map<String, Integer> fields,
+ @Nullable String affKeyFieldName) {
+ assert typeName != null;
+
+ this.typeId = typeId;
+ this.typeName = typeName;
+ this.fields = fields;
+ this.affKeyFieldName = affKeyFieldName;
+ }
+
+ /**
+ * @return Type ID.
+ */
+ public int typeId() {
+ return typeId;
+ }
+
+ /**
+ * @return Type name.
+ */
+ public String typeName() {
+ return typeName;
+ }
+
+ /**
+ * @return Fields.
+ */
+ public Collection<String> fields() {
+ return fields != null ? fields.keySet() : Collections.<String>emptyList();
+ }
+
+ /**
+ * @return Fields.
+ */
+ public Map<String, Integer> fieldsMap() {
+ return fields != null ? fields : Collections.<String, Integer>emptyMap();
+ }
+
+ /**
+ * @param fieldName Field name.
+ * @return Field type name.
+ */
+ @Nullable public String fieldTypeName(String fieldName) {
+ Integer typeId = fields != null ? fields.get(fieldName) : null;
+
+ return typeId != null ? PortableUtils.fieldTypeName(typeId) : null;
+ }
+
+ /**
+ * @return Affinity key field name.
+ */
+ @Nullable public String affinityKeyFieldName() {
+ return affKeyFieldName;
+ }
+
+ /**
+ * Wrap metadata into binary type.
+ *
+ * @param ctx Portable context.
+ * @return Binary type.
+ */
+ public BinaryTypeImpl wrap(PortableContext ctx) {
+ return new BinaryTypeImpl(ctx, this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(typeId);
+ U.writeString(out, typeName);
+ U.writeMap(out, fields);
+ U.writeString(out, affKeyFieldName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ typeId = in.readInt();
+ typeName = U.readString(in);
+ fields = U.readMap(in);
+ affKeyFieldName = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(BinaryMetadata.class, this);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java
new file mode 100644
index 0000000..add8c2d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+
+/**
+ * Portable meta data handler.
+ */
+public interface BinaryMetadataHandler {
+ /**
+ * Adds meta data.
+ *
+ * @param typeId Type ID.
+ * @param meta Meta data.
+ * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ */
+ public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException;
+
+ /**
+ * Gets meta data for provided type ID.
+ *
+ * @param typeId Type ID.
+ * @return Meta data.
+ * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ */
+ public BinaryType metadata(int typeId) throws BinaryObjectException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java
new file mode 100644
index 0000000..c4fc5e3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+
+/**
+ * No-op metadata handler.
+ */
+public class BinaryNoopMetadataHandler implements BinaryMetadataHandler {
+ /** Cached singleton instance. */
+ private static final BinaryNoopMetadataHandler INSTANCE = new BinaryNoopMetadataHandler();
+
+ /**
+ * @return Instance.
+ */
+ public static BinaryNoopMetadataHandler instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Private constructor.
+ */
+ private BinaryNoopMetadataHandler() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryType metadata(int typeId) throws BinaryObjectException {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectEx.java
index 50b9d42..b3512ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectEx.java
@@ -176,10 +176,10 @@ public abstract class BinaryObjectEx implements BinaryObject {
SB buf = new SB(meta.typeName());
- if (meta.fields() != null) {
+ if (meta.fieldNames() != null) {
buf.a(" [hash=").a(idHash);
- for (String name : meta.fields()) {
+ for (String name : meta.fieldNames()) {
Object val = field(ctx, name);
buf.a(", ").a(name).a('=');
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
index 800ca40..d432ea0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
@@ -462,19 +462,6 @@ public final class BinaryObjectImpl extends BinaryObjectEx implements Externaliz
}
/** {@inheritDoc} */
- @Override public BinaryField fieldDescriptor(String fieldName) throws BinaryObjectException {
- A.notNull(fieldName, "fieldName");
-
- int typeId = typeId();
-
- PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
-
- int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
-
- return new BinaryFieldImpl(schemaReg, fieldName, fieldId);
- }
-
- /** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
index 9b6735f..f7cb844 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
@@ -140,19 +140,6 @@ public class BinaryObjectOffheapImpl extends BinaryObjectEx implements Externali
}
/** {@inheritDoc} */
- @Override public BinaryField fieldDescriptor(String fieldName) throws BinaryObjectException {
- A.notNull(fieldName, "fieldName");
-
- int typeId = typeId();
-
- PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
-
- int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
-
- return new BinaryFieldImpl(schemaReg, fieldName, fieldId);
- }
-
- /** {@inheritDoc} */
@Override public int start() {
return start;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
new file mode 100644
index 0000000..40b6252
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.binary.BinaryType;
+
+import java.util.Collection;
+
+/**
+ * Binary type implementation.
+ */
+public class BinaryTypeImpl implements BinaryType {
+ /** Portable context. */
+ private final PortableContext ctx;
+
+ /** Type metadata. */
+ private final BinaryMetadata meta;
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Portable context.
+ * @param meta Type metadata.
+ */
+ public BinaryTypeImpl(PortableContext ctx, BinaryMetadata meta) {
+ this.ctx = ctx;
+ this.meta = meta;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String typeName() {
+ return meta.typeName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> fieldNames() {
+ return meta.fields();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String fieldTypeName(String fieldName) {
+ return meta.fieldTypeName(fieldName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryFieldImpl field(String fieldName) {
+ return ctx.createField(meta.typeId(), fieldName);
+ }
+
+ public String affinityKeyFieldName() {
+ return meta.affinityKeyFieldName();
+ }
+
+ /**
+ * @return Metadata.
+ */
+ public BinaryMetadata metadata() {
+ return meta;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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 c9870b4..225e0ba 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
@@ -92,7 +92,7 @@ public class PortableClassDescriptor {
private final Method readResolveMtd;
/** */
- private final Map<String, String> fieldsMeta;
+ private final Map<String, Integer> fieldsMeta;
/** */
private final boolean keepDeserialized;
@@ -182,7 +182,7 @@ public class PortableClassDescriptor {
case UUID_ARR:
case DATE_ARR:
case TIMESTAMP_ARR:
- case OBJ_ARR:
+ case OBJECT_ARR:
case COL:
case MAP:
case MAP_ENTRY:
@@ -210,7 +210,7 @@ public class PortableClassDescriptor {
ctor = constructor(cls);
fields = new ArrayList<>();
- fieldsMeta = metaDataEnabled ? new HashMap<String, String>() : null;
+ fieldsMeta = metaDataEnabled ? new HashMap<String, Integer>() : null;
Collection<String> names = new HashSet<>();
Collection<Integer> ids = new HashSet<>();
@@ -237,7 +237,7 @@ public class PortableClassDescriptor {
fields.add(fieldInfo);
if (metaDataEnabled)
- fieldsMeta.put(name, fieldInfo.fieldMode().typeName());
+ fieldsMeta.put(name, fieldInfo.fieldMode().typeId());
}
}
}
@@ -283,7 +283,7 @@ public class PortableClassDescriptor {
/**
* @return Fields meta data.
*/
- Map<String, String> fieldsMeta() {
+ Map<String, Integer> fieldsMeta() {
return fieldsMeta;
}
@@ -337,6 +337,7 @@ public class PortableClassDescriptor {
/**
* @return portableReadResolve() method
*/
+ @SuppressWarnings("UnusedDeclaration")
@Nullable Method getReadResolveMethod() {
return readResolveMtd;
}
@@ -430,66 +431,66 @@ public class PortableClassDescriptor {
break;
case SHORT_ARR:
- writer.doWriteShortArray((short[])obj);
+ writer.doWriteShortArray((short[]) obj);
break;
case INT_ARR:
- writer.doWriteIntArray((int[])obj);
+ writer.doWriteIntArray((int[]) obj);
break;
case LONG_ARR:
- writer.doWriteLongArray((long[])obj);
+ writer.doWriteLongArray((long[]) obj);
break;
case FLOAT_ARR:
- writer.doWriteFloatArray((float[])obj);
+ writer.doWriteFloatArray((float[]) obj);
break;
case DOUBLE_ARR:
- writer.doWriteDoubleArray((double[])obj);
+ writer.doWriteDoubleArray((double[]) obj);
break;
case CHAR_ARR:
- writer.doWriteCharArray((char[])obj);
+ writer.doWriteCharArray((char[]) obj);
break;
case BOOLEAN_ARR:
- writer.doWriteBooleanArray((boolean[])obj);
+ writer.doWriteBooleanArray((boolean[]) obj);
break;
case DECIMAL_ARR:
- writer.doWriteDecimalArray((BigDecimal[])obj);
+ writer.doWriteDecimalArray((BigDecimal[]) obj);
break;
case STRING_ARR:
- writer.doWriteStringArray((String[])obj);
+ writer.doWriteStringArray((String[]) obj);
break;
case UUID_ARR:
- writer.doWriteUuidArray((UUID[])obj);
+ writer.doWriteUuidArray((UUID[]) obj);
break;
case DATE_ARR:
- writer.doWriteDateArray((Date[])obj);
+ writer.doWriteDateArray((Date[]) obj);
break;
case TIMESTAMP_ARR:
- writer.doWriteTimestampArray((Timestamp[])obj);
+ writer.doWriteTimestampArray((Timestamp[]) obj);
break;
- case OBJ_ARR:
+ case OBJECT_ARR:
writer.doWriteObjectArray((Object[])obj);
break;
@@ -543,9 +544,9 @@ public class PortableClassDescriptor {
writer.popSchema();
}
- if (obj.getClass() != BinaryMetaDataImpl.class
+ if (obj.getClass() != BinaryMetadata.class
&& ctx.isMetaDataChanged(typeId, writer.metaDataHashSum())) {
- BinaryMetaDataCollector metaCollector = new BinaryMetaDataCollector(typeName);
+ BinaryMetadataCollector metaCollector = new BinaryMetadataCollector(typeName);
if (serializer != null)
serializer.writeBinary(obj, metaCollector);
@@ -711,6 +712,7 @@ public class PortableClassDescriptor {
* @return Constructor.
* @throws org.apache.ignite.binary.BinaryObjectException If constructor doesn't exist.
*/
+ @SuppressWarnings("ConstantConditions")
@Nullable private static Constructor<?> constructor(Class<?> cls) throws BinaryObjectException {
assert cls != null;
@@ -739,11 +741,8 @@ public class PortableClassDescriptor {
Method writeObj = cls.getDeclaredMethod("writeObject", ObjectOutputStream.class);
Method readObj = cls.getDeclaredMethod("readObject", ObjectInputStream.class);
- if (!Modifier.isStatic(writeObj.getModifiers()) && !Modifier.isStatic(readObj.getModifiers()) &&
- writeObj.getReturnType() == void.class && readObj.getReturnType() == void.class)
- use = true;
- else
- use = false;
+ use = !Modifier.isStatic(writeObj.getModifiers()) && !Modifier.isStatic(readObj.getModifiers()) &&
+ writeObj.getReturnType() == void.class && readObj.getReturnType() == void.class;
}
catch (NoSuchMethodException e) {
use = false;
@@ -813,7 +812,7 @@ public class PortableClassDescriptor {
else if (cls == Timestamp[].class)
return Mode.TIMESTAMP_ARR;
else if (cls.isArray())
- return cls.getComponentType().isEnum() ? Mode.ENUM_ARR : Mode.OBJ_ARR;
+ return cls.getComponentType().isEnum() ? Mode.ENUM_ARR : Mode.OBJECT_ARR;
else if (cls == BinaryObjectImpl.class)
return Mode.PORTABLE_OBJ;
else if (Binarylizable.class.isAssignableFrom(cls))
@@ -961,66 +960,66 @@ public class PortableClassDescriptor {
break;
case SHORT_ARR:
- writer.writeShortArrayField((short[])val);
+ writer.writeShortArrayField((short[]) val);
break;
case INT_ARR:
- writer.writeIntArrayField((int[])val);
+ writer.writeIntArrayField((int[]) val);
break;
case LONG_ARR:
- writer.writeLongArrayField((long[])val);
+ writer.writeLongArrayField((long[]) val);
break;
case FLOAT_ARR:
- writer.writeFloatArrayField((float[])val);
+ writer.writeFloatArrayField((float[]) val);
break;
case DOUBLE_ARR:
- writer.writeDoubleArrayField((double[])val);
+ writer.writeDoubleArrayField((double[]) val);
break;
case CHAR_ARR:
- writer.writeCharArrayField((char[])val);
+ writer.writeCharArrayField((char[]) val);
break;
case BOOLEAN_ARR:
- writer.writeBooleanArrayField((boolean[])val);
+ writer.writeBooleanArrayField((boolean[]) val);
break;
case DECIMAL_ARR:
- writer.writeDecimalArrayField((BigDecimal[])val);
+ writer.writeDecimalArrayField((BigDecimal[]) val);
break;
case STRING_ARR:
- writer.writeStringArrayField((String[])val);
+ writer.writeStringArrayField((String[]) val);
break;
case UUID_ARR:
- writer.writeUuidArrayField((UUID[])val);
+ writer.writeUuidArrayField((UUID[]) val);
break;
case DATE_ARR:
- writer.writeDateArrayField((Date[])val);
+ writer.writeDateArrayField((Date[]) val);
break;
case TIMESTAMP_ARR:
- writer.writeTimestampArrayField((Timestamp[])val);
+ writer.writeTimestampArrayField((Timestamp[]) val);
break;
- case OBJ_ARR:
+ case OBJECT_ARR:
writer.writeObjectArrayField((Object[])val);
break;
@@ -1211,7 +1210,7 @@ public class PortableClassDescriptor {
break;
- case OBJ_ARR:
+ case OBJECT_ARR:
val = reader.readObjectArray(id);
break;
@@ -1275,134 +1274,134 @@ public class PortableClassDescriptor {
/** */
enum Mode {
/** */
- BYTE("byte"),
+ BYTE(GridPortableMarshaller.BYTE),
/** */
- SHORT("short"),
+ SHORT(GridPortableMarshaller.SHORT),
/** */
- INT("int"),
+ INT(GridPortableMarshaller.INT),
/** */
- LONG("long"),
+ LONG(GridPortableMarshaller.LONG),
/** */
- FLOAT("float"),
+ FLOAT(GridPortableMarshaller.FLOAT),
/** */
- DOUBLE("double"),
+ DOUBLE(GridPortableMarshaller.DOUBLE),
/** */
- CHAR("char"),
+ CHAR(GridPortableMarshaller.CHAR),
/** */
- BOOLEAN("boolean"),
+ BOOLEAN(GridPortableMarshaller.BOOLEAN),
/** */
- DECIMAL("decimal"),
+ DECIMAL(GridPortableMarshaller.DECIMAL),
/** */
- STRING("String"),
+ STRING(GridPortableMarshaller.STRING),
/** */
- UUID("UUID"),
+ UUID(GridPortableMarshaller.UUID),
/** */
- DATE("Date"),
+ DATE(GridPortableMarshaller.DATE),
/** */
- TIMESTAMP("Timestamp"),
+ TIMESTAMP(GridPortableMarshaller.TIMESTAMP),
/** */
- BYTE_ARR("byte[]"),
+ BYTE_ARR(GridPortableMarshaller.BYTE_ARR),
/** */
- SHORT_ARR("short[]"),
+ SHORT_ARR(GridPortableMarshaller.SHORT_ARR),
/** */
- INT_ARR("int[]"),
+ INT_ARR(GridPortableMarshaller.INT_ARR),
/** */
- LONG_ARR("long[]"),
+ LONG_ARR(GridPortableMarshaller.LONG_ARR),
/** */
- FLOAT_ARR("float[]"),
+ FLOAT_ARR(GridPortableMarshaller.FLOAT_ARR),
/** */
- DOUBLE_ARR("double[]"),
+ DOUBLE_ARR(GridPortableMarshaller.DOUBLE_ARR),
/** */
- CHAR_ARR("char[]"),
+ CHAR_ARR(GridPortableMarshaller.CHAR_ARR),
/** */
- BOOLEAN_ARR("boolean[]"),
+ BOOLEAN_ARR(GridPortableMarshaller.BOOLEAN_ARR),
/** */
- DECIMAL_ARR("decimal[]"),
+ DECIMAL_ARR(GridPortableMarshaller.DECIMAL_ARR),
/** */
- STRING_ARR("String[]"),
+ STRING_ARR(GridPortableMarshaller.STRING_ARR),
/** */
- UUID_ARR("UUID[]"),
+ UUID_ARR(GridPortableMarshaller.UUID_ARR),
/** */
- DATE_ARR("Date[]"),
+ DATE_ARR(GridPortableMarshaller.DATE_ARR),
/** */
- TIMESTAMP_ARR("Timestamp[]"),
+ TIMESTAMP_ARR(GridPortableMarshaller.TIMESTAMP_ARR),
/** */
- OBJ_ARR("Object[]"),
+ OBJECT_ARR(GridPortableMarshaller.OBJ_ARR),
/** */
- COL("Collection"),
+ COL(GridPortableMarshaller.COL),
/** */
- MAP("Map"),
+ MAP(GridPortableMarshaller.MAP),
/** */
- MAP_ENTRY("Entry"),
+ MAP_ENTRY(GridPortableMarshaller.MAP_ENTRY),
/** */
- PORTABLE_OBJ("Object"),
+ PORTABLE_OBJ(GridPortableMarshaller.OBJ),
/** */
- ENUM("Enum"),
+ ENUM(GridPortableMarshaller.ENUM),
/** */
- ENUM_ARR("Enum[]"),
+ ENUM_ARR(GridPortableMarshaller.ENUM_ARR),
/** */
- CLASS("Class"),
+ CLASS(GridPortableMarshaller.CLASS),
/** */
- PORTABLE("Object"),
+ PORTABLE(GridPortableMarshaller.PORTABLE_OBJ),
/** */
- EXTERNALIZABLE("Object"),
+ EXTERNALIZABLE(GridPortableMarshaller.OBJ),
/** */
- OBJECT("Object"),
+ OBJECT(GridPortableMarshaller.OBJ),
/** */
- EXCLUSION("Exclusion");
+ EXCLUSION(GridPortableMarshaller.OBJ);
/** */
- private final String typeName;
+ private final int typeId;
/**
- * @param typeName Type name.
+ * @param typeId Type ID.
*/
- Mode(String typeName) {
- this.typeName = typeName;
+ Mode(int typeId) {
+ this.typeId = typeId;
}
/**
- * @return Type name.
+ * @return Type ID.
*/
- String typeName() {
- return typeName;
+ int typeId() {
+ return typeId;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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 928be63..86578ad 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
@@ -134,7 +134,7 @@ public class PortableContext implements Externalizable {
private final Map<String, BinaryIdMapper> typeMappers = new ConcurrentHashMap8<>(0);
/** */
- private PortableMetaDataHandler metaHnd;
+ private BinaryMetadataHandler metaHnd;
/** */
private MarshallerContext marshCtx;
@@ -165,8 +165,9 @@ public class PortableContext implements Externalizable {
* @param metaHnd Meta data handler.
* @param igniteCfg Ignite configuration.
*/
- public PortableContext(PortableMetaDataHandler metaHnd, @Nullable IgniteConfiguration igniteCfg) {
+ public PortableContext(BinaryMetadataHandler metaHnd, IgniteConfiguration igniteCfg) {
assert metaHnd != null;
+ assert igniteCfg != null;
this.metaHnd = metaHnd;
this.igniteCfg = igniteCfg;
@@ -202,7 +203,6 @@ public class PortableContext implements Externalizable {
registerPredefinedType(Date.class, GridPortableMarshaller.DATE);
registerPredefinedType(Timestamp.class, GridPortableMarshaller.TIMESTAMP);
registerPredefinedType(UUID.class, GridPortableMarshaller.UUID);
- // TODO: How to handle timestamp? It has the same ID in .Net.
registerPredefinedType(byte[].class, GridPortableMarshaller.BYTE_ARR);
registerPredefinedType(short[].class, GridPortableMarshaller.SHORT_ARR);
@@ -237,9 +237,6 @@ public class PortableContext implements Externalizable {
registerPredefinedType(T2.class, 62);
// IDs range [200..1000] is used by Ignite internal APIs.
-
- registerPredefinedType(BinaryObjectImpl.class, 200);
- registerPredefinedType(BinaryMetaDataImpl.class, 201);
}
/**
@@ -570,7 +567,7 @@ public class PortableContext implements Externalizable {
mappers.putIfAbsent(typeId, idMapper);
- metaHnd.addMeta(typeId, new BinaryMetaDataImpl(typeName, desc.fieldsMeta(), null));
+ metaHnd.addMeta(typeId, new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), null).wrap(this));
return desc;
}
@@ -752,7 +749,7 @@ public class PortableContext implements Externalizable {
typeMappers.put(typeName, idMapper);
- Map<String, String> fieldsMeta = null;
+ Map<String, Integer> fieldsMeta = null;
if (cls != null) {
PortableClassDescriptor desc = new PortableClassDescriptor(
@@ -777,7 +774,22 @@ public class PortableContext implements Externalizable {
descByCls.put(cls, desc);
}
- metaHnd.addMeta(id, new BinaryMetaDataImpl(typeName, fieldsMeta, affKeyFieldName));
+ metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName).wrap(this));
+ }
+
+ /**
+ * Create binary field.
+ *
+ * @param typeId Type ID.
+ * @param fieldName Field name.
+ * @return Binary field.
+ */
+ public BinaryFieldImpl createField(int typeId, String fieldName) {
+ PortableSchemaRegistry schemaReg = schemaRegistry(typeId);
+
+ int fieldId = userTypeIdMapper(typeId).fieldId(typeId, fieldName);
+
+ return new BinaryFieldImpl(typeId, schemaReg, fieldName, fieldId);
}
/**
@@ -816,8 +828,8 @@ public class PortableContext implements Externalizable {
* @param fields Fields map.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
- public void updateMetaData(int typeId, String typeName, Map<String, String> fields) throws BinaryObjectException {
- updateMetaData(typeId, new BinaryMetaDataImpl(typeName, fields, null));
+ public void updateMetaData(int typeId, String typeName, Map<String, Integer> fields) throws BinaryObjectException {
+ updateMetaData(typeId, new BinaryMetadata(typeId, typeName, fields, null));
}
/**
@@ -825,8 +837,8 @@ public class PortableContext implements Externalizable {
* @param meta Meta data.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
- public void updateMetaData(int typeId, BinaryMetaDataImpl meta) throws BinaryObjectException {
- metaHnd.addMeta(typeId, meta);
+ public void updateMetaData(int typeId, BinaryMetadata meta) throws BinaryObjectException {
+ metaHnd.addMeta(typeId, meta.wrap(this));
}
/**
@@ -890,6 +902,7 @@ public class PortableContext implements Externalizable {
* @param clsName Class name.
* @return Type name.
*/
+ @SuppressWarnings("ResultOfMethodCallIgnored")
public static String typeName(String clsName) {
assert clsName != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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
deleted file mode 100644
index 8b2eef2..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryType;
-
-/**
- * Portable meta data handler.
- */
-public interface PortableMetaDataHandler {
- /**
- * Adds meta data.
- *
- * @param typeId Type ID.
- * @param meta Meta data.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
- */
- public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException;
-
- /**
- * Gets meta data for provided type ID.
- *
- * @param typeId Type ID.
- * @return Meta data.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
- */
- public BinaryType metadata(int typeId) throws BinaryObjectException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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 fe97e7e..31f2bf9 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
@@ -49,6 +49,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE_ARR;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR_ARR;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLASS;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.COL;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE_ARR;
@@ -69,6 +70,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENT
import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.PORTABLE_OBJ;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.PROTO_VER;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT_ARR;
@@ -116,6 +118,92 @@ public class PortableUtils {
/** Offset which fits into 4 bytes. */
public static final int OFFSET_4 = 4;
+ /** Field type names. */
+ private static final String[] FIELD_TYPE_NAMES;
+
+ static {
+ FIELD_TYPE_NAMES = new String[104];
+
+ FIELD_TYPE_NAMES[BYTE] = "byte";
+ FIELD_TYPE_NAMES[SHORT] = "short";
+ FIELD_TYPE_NAMES[INT] = "int";
+ FIELD_TYPE_NAMES[LONG] = "long";
+ FIELD_TYPE_NAMES[BOOLEAN] = "boolean";
+ FIELD_TYPE_NAMES[FLOAT] = "float";
+ FIELD_TYPE_NAMES[DOUBLE] = "double";
+ FIELD_TYPE_NAMES[CHAR] = "char";
+ FIELD_TYPE_NAMES[UUID] = "UUID";
+ FIELD_TYPE_NAMES[DECIMAL] = "decimal";
+ FIELD_TYPE_NAMES[STRING] = "String";
+ FIELD_TYPE_NAMES[DATE] = "Date";
+ FIELD_TYPE_NAMES[TIMESTAMP] = "Timestamp";
+ FIELD_TYPE_NAMES[ENUM] = "Enum";
+ FIELD_TYPE_NAMES[OBJ] = "Object";
+ FIELD_TYPE_NAMES[PORTABLE_OBJ] = "Object";
+ FIELD_TYPE_NAMES[COL] = "Collection";
+ FIELD_TYPE_NAMES[MAP] = "Map";
+ FIELD_TYPE_NAMES[MAP_ENTRY] = "Entry";
+ FIELD_TYPE_NAMES[CLASS] = "Class";
+ FIELD_TYPE_NAMES[BYTE_ARR] = "byte[]";
+ FIELD_TYPE_NAMES[SHORT_ARR] = "short[]";
+ FIELD_TYPE_NAMES[INT_ARR] = "int[]";
+ FIELD_TYPE_NAMES[LONG_ARR] = "long[]";
+ FIELD_TYPE_NAMES[BOOLEAN_ARR] = "boolean[]";
+ FIELD_TYPE_NAMES[FLOAT_ARR] = "float[]";
+ FIELD_TYPE_NAMES[DOUBLE_ARR] = "double[]";
+ FIELD_TYPE_NAMES[CHAR_ARR] = "char[]";
+ FIELD_TYPE_NAMES[UUID_ARR] = "UUID[]";
+ FIELD_TYPE_NAMES[DECIMAL_ARR] = "decimal[]";
+ FIELD_TYPE_NAMES[STRING_ARR] = "String[]";
+ FIELD_TYPE_NAMES[DATE_ARR] = "Date[]";
+ FIELD_TYPE_NAMES[TIMESTAMP_ARR] = "Timestamp[]";
+ FIELD_TYPE_NAMES[OBJ_ARR] = "Object[]";
+ FIELD_TYPE_NAMES[ENUM_ARR] = "Enum[]";
+ }
+
+ /**
+ * @param typeName Field type name.
+ * @return Field type ID;
+ */
+ @SuppressWarnings("StringEquality")
+ public static int fieldTypeId(String typeName) {
+ for (int i = 0; i < FIELD_TYPE_NAMES.length; i++) {
+ String typeName0 = FIELD_TYPE_NAMES[i];
+
+ if (typeName.equals(typeName0))
+ return i;
+ }
+
+ throw new IllegalArgumentException("Invalid metadata type name: " + typeName);
+ }
+
+ /**
+ * @param typeId Field type ID.
+ * @return Field type name.
+ */
+ public static String fieldTypeName(int typeId) {
+ assert typeId >= 0 && typeId < FIELD_TYPE_NAMES.length : typeId;
+
+ String typeName = FIELD_TYPE_NAMES[typeId];
+
+ assert typeName != null : typeId;
+
+ return typeName;
+ }
+
+ /**
+ * @param typeIds Field type IDs.
+ * @return Field type names.
+ */
+ public static Map<String, String> fieldTypeNames(Map<String, Integer> typeIds) {
+ Map<String, String> names = U.newHashMap(typeIds.size());
+
+ for (Map.Entry<String, Integer> e : typeIds.entrySet())
+ names.put(e.getKey(), fieldTypeName(e.getValue()));
+
+ return names;
+ }
+
/**
* Write flags.
*
@@ -471,22 +559,6 @@ public class PortableUtils {
}
/**
- * Tells whether provided type is portable or a collection.
- *
- * @param cls Class to check.
- * @return Whether type is portable or a collection.
- */
- public static boolean isPortableOrCollectionType(Class<?> cls) {
- assert cls != null;
-
- return isPortableType(cls) ||
- cls == Object[].class ||
- Collection.class.isAssignableFrom(cls) ||
- Map.class.isAssignableFrom(cls) ||
- Map.Entry.class.isAssignableFrom(cls);
- }
-
- /**
* Tells whether provided type is portable.
*
* @param cls Class to check.
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index 777d30b..ca8f09b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -17,15 +17,10 @@
package org.apache.ignite.internal.portable.builder;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryInvalidTypeException;
import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.internal.portable.BinaryObjectImpl;
import org.apache.ignite.internal.portable.BinaryObjectOffheapImpl;
@@ -33,13 +28,18 @@ import org.apache.ignite.internal.portable.BinaryWriterExImpl;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableContext;
import org.apache.ignite.internal.portable.PortableUtils;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.util.GridArgumentCheck;
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.jetbrains.annotations.Nullable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
import static org.apache.ignite.internal.portable.GridPortableMarshaller.DFLT_HDR_LEN;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.FLAGS_POS;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.HASH_CODE_POS;
@@ -284,7 +284,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
if (assignedVals != null && (remainsFlds == null || !remainsFlds.isEmpty())) {
BinaryType metadata = ctx.metaData(typeId);
- Map<String, String> newFldsMetadata = null;
+ Map<String, Integer> newFldsMetadata = null;
for (Map.Entry<String, Object> entry : assignedVals.entrySet()) {
Object val = entry.getValue();
@@ -305,15 +305,14 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
String oldFldTypeName = metadata == null ? null : metadata.fieldTypeName(name);
- String newFldTypeName;
+ int newFldTypeId;
if (val instanceof PortableValueWithType)
- newFldTypeName = ((PortableValueWithType) val).typeName();
- else {
- byte type = PortableUtils.typeByClass(val.getClass());
+ newFldTypeId = ((PortableValueWithType) val).typeId();
+ else
+ newFldTypeId = PortableUtils.typeByClass(val.getClass());
- newFldTypeName = CacheObjectBinaryProcessorImpl.fieldTypeName(type);
- }
+ String newFldTypeName = PortableUtils.fieldTypeName(newFldTypeId);
if (oldFldTypeName == null) {
// It's a new field, we have to add it to metadata.
@@ -321,11 +320,10 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
if (newFldsMetadata == null)
newFldsMetadata = new HashMap<>();
- newFldsMetadata.put(name, newFldTypeName);
+ newFldsMetadata.put(name, PortableUtils.fieldTypeId(newFldTypeName));
}
else {
- String objTypeName =
- CacheObjectBinaryProcessorImpl.FIELD_TYPE_NAMES[GridPortableMarshaller.OBJ];
+ String objTypeName = PortableUtils.fieldTypeName(GridPortableMarshaller.OBJ);
if (!objTypeName.equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName)) {
throw new BinaryObjectException(
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
index 5ea8e62..5d66328 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.BinaryWriterExImpl;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
@@ -48,9 +47,11 @@ class PortableValueWithType implements PortableLazyValue {
ctx.writeValue(writer, val);
}
- /** {@inheritDoc} */
- public String typeName() {
- return CacheObjectBinaryProcessorImpl.fieldTypeName(type);
+ /**
+ * @return Type ID.
+ */
+ public int typeId() {
+ return type;
}
/** {@inheritDoc} */
[22/50] [abbrv] ignite git commit: ignite-1.5 Update store benchmark
config.
Posted by vo...@apache.org.
ignite-1.5 Update store benchmark config.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/55c227a5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/55c227a5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/55c227a5
Branch: refs/heads/ignite-1816
Commit: 55c227a5920223c30be73b304e98dfc34ea8f998
Parents: 8cc9fa4
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Nov 12 09:45:39 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Nov 12 09:45:39 2015 +0700
----------------------------------------------------------------------
.../yardstick/config/benchmark-store.properties | 86 ++++++++++++--------
1 file changed, 50 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/55c227a5/modules/yardstick/config/benchmark-store.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-store.properties b/modules/yardstick/config/benchmark-store.properties
index bda136e..746fa11 100644
--- a/modules/yardstick/config/benchmark-store.properties
+++ b/modules/yardstick/config/benchmark-store.properties
@@ -1,4 +1,3 @@
-#
# 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.
@@ -13,7 +12,6 @@
# 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 all benchmarks for:
@@ -28,36 +26,40 @@ JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
JVM_OPTS=${JVM_OPTS}" \
- -Xloggc:./gc${now0}.log \
- -XX:+PrintGCDetails \
- -verbose:gc \
- -XX:+UseParNewGC \
- -XX:+UseConcMarkSweepGC \
- -XX:+UseTLAB \
- -XX:NewSize=128m \
- -XX:MaxNewSize=128m \
- -XX:MaxTenuringThreshold=0 \
- -XX:SurvivorRatio=1024 \
- -XX:+UseCMSInitiatingOccupancyOnly \
- -XX:CMSInitiatingOccupancyFraction=60 \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+UseTLAB \
+-XX:NewSize=128m \
+-XX:MaxNewSize=128m \
+-XX:MaxTenuringThreshold=0 \
+-XX:SurvivorRatio=1024 \
+-XX:+UseCMSInitiatingOccupancyOnly \
+-XX:CMSInitiatingOccupancyFraction=60 \
"
+#Ignite version
+ver="RELEASE-"
+
# List of default probes.
# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
-BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
# Packages where the specified benchmark is searched by reflection mechanism.
BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+# Restart servers for each benchmark.
RESTART_SERVERS=true
# Probe point writer class name.
# BENCHMARK_WRITER=
-# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+# Comma-separated list of the hosts to run BenchmarkServers on.
SERVER_HOSTS=localhost
-# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+# Comma-separated list of the hosts to run BenchmarkDrivers on.
DRIVER_HOSTS=localhost
# Remote username.
@@ -66,27 +68,39 @@ DRIVER_HOSTS=localhost
# Number of nodes, used to wait for the specified number of nodes to start.
nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
-# Each benchmark warm_up set to 60 seconds (1 minute).
-warm_up=60
+# Backups count.
+b=1
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Sync mode.
+sm=PRIMARY_SYNC
-# Each benchmark run set to 300 seconds (5 mins).
-run=300
+# Jobs.
+j=10
# Run configuration which contains all benchmarks.
CONFIGS="\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -ds atomic-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -cs -ds atomic-store-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -ds tx-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -cs -ds tx-store-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -ds atomic-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -cs -ds atomic-store-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -ds tx-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -cs -ds tx-store-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -ds atomic-put-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -cs -ds atomic-store-put-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-put-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -ds tx-put-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -cs -ds tx-store-put-get\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -ds atomic-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -cs -ds atomic-store-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -ds tx-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -cs -ds tx-store-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -ds atomic-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -cs -ds atomic-store-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -ds tx-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -cs -ds tx-store-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -ds atomic-put-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -cs -ds atomic-store-put-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-put-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -ds tx-put-get,\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -cs -ds tx-store-put-get\
"
[21/50] [abbrv] ignite git commit: Added tx-getAll PutAll benchmarks
(fix in properties)
Posted by vo...@apache.org.
Added tx-getAll PutAll benchmarks (fix in properties)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8cc9fa4f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8cc9fa4f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8cc9fa4f
Branch: refs/heads/ignite-1816
Commit: 8cc9fa4ff51926190d4d75b5b41f07b20e910144
Parents: 847b616
Author: ashutak <as...@gridgain.com>
Authored: Wed Nov 11 18:55:25 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Wed Nov 11 18:55:25 2015 +0300
----------------------------------------------------------------------
modules/yardstick/config/benchmark-multicast.properties | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cc9fa4f/modules/yardstick/config/benchmark-multicast.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-multicast.properties b/modules/yardstick/config/benchmark-multicast.properties
index 577d611..c508471 100644
--- a/modules/yardstick/config/benchmark-multicast.properties
+++ b/modules/yardstick/config/benchmark-multicast.properties
@@ -111,7 +111,7 @@ CONFIGS="\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc OPTIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-optimistic-getAllPutAll-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc PESSIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-pessimistic-getAllPutAll-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc OPTIMISTIC -txi SERIALIZABLE -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-opt-serializable-getAllPutAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc OPTIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-optimistic-getAllPutAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc PESSIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-pessimistic-getAllPutAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc OPTIMISTIC -txi SERIALIZABLE -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-opt-serializable-getAllPutAll-1-backup,\
"
[46/50] [abbrv] ignite git commit: IGNITE-1847: Added "field" method
to BinaryType and reworked internal metadata handling.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index 98b619e..117eece 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -17,41 +17,26 @@
package org.apache.ignite.internal.processors.cache.portable;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-import javax.cache.Cache;
-import javax.cache.CacheException;
-import javax.cache.event.CacheEntryEvent;
-import javax.cache.event.CacheEntryListenerException;
-import javax.cache.event.CacheEntryUpdatedListener;
-import javax.cache.event.EventType;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.cluster.ClusterTopologyException;
-import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
-import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectBuilder;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.internal.portable.PortableMetaDataHandler;
-import org.apache.ignite.internal.portable.BinaryMetaDataImpl;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.portable.BinaryMetadata;
import org.apache.ignite.internal.portable.BinaryObjectImpl;
import org.apache.ignite.internal.portable.BinaryObjectOffheapImpl;
+import org.apache.ignite.internal.portable.BinaryTypeImpl;
+import org.apache.ignite.internal.portable.GridPortableMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.internal.portable.BinaryMetadataHandler;
import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.portable.builder.BinaryObjectBuilderImpl;
import org.apache.ignite.internal.portable.streams.PortableInputStream;
@@ -82,51 +67,33 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
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.lang.IgniteClosure;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.binary.BinaryObjectBuilder;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryObject;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import sun.misc.Unsafe;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.BOOLEAN;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.BOOLEAN_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLASS;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.COL;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DECIMAL;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DECIMAL_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DOUBLE;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DOUBLE_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.ENUM;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.ENUM_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.FLOAT;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.FLOAT_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.MAP_ENTRY;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.PORTABLE_OBJ;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.STRING;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.STRING_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.TIMESTAMP;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.TIMESTAMP_ARR;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID_ARR;
+import javax.cache.Cache;
+import javax.cache.CacheException;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryListenerException;
+import javax.cache.event.CacheEntryUpdatedListener;
+import javax.cache.event.EventType;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
/**
* Portable processor implementation.
@@ -134,9 +101,6 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID_AR
public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorImpl implements
CacheObjectBinaryProcessor {
/** */
- public static final String[] FIELD_TYPE_NAMES;
-
- /** */
private static final Unsafe UNSAFE = GridUnsafe.unsafe();
/** */
@@ -146,17 +110,17 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private final boolean clientNode;
/** */
- private volatile IgniteCacheProxy<PortableMetaDataKey, BinaryType> metaDataCache;
+ private volatile IgniteCacheProxy<PortableMetadataKey, BinaryMetadata> metaDataCache;
/** */
- private final ConcurrentHashMap8<PortableMetaDataKey, BinaryType> clientMetaDataCache;
+ private final ConcurrentHashMap8<Integer, BinaryTypeImpl> clientMetaDataCache;
/** Predicate to filter portable meta data in utility cache. */
private final CacheEntryPredicate metaPred = new CacheEntryPredicateAdapter() {
private static final long serialVersionUID = 0L;
@Override public boolean apply(GridCacheEntryEx e) {
- return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetaDataKey;
+ return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey;
}
};
@@ -174,98 +138,12 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private IgniteBinary portables;
/** Metadata updates collected before metadata cache is initialized. */
- private final Map<Integer, BinaryType> metaBuf = new ConcurrentHashMap<>();
+ private final Map<Integer, BinaryMetadata> metaBuf = new ConcurrentHashMap<>();
/** */
private UUID metaCacheQryId;
/**
- *
- */
- static {
- FIELD_TYPE_NAMES = new String[104];
-
- FIELD_TYPE_NAMES[BYTE] = "byte";
- FIELD_TYPE_NAMES[SHORT] = "short";
- FIELD_TYPE_NAMES[INT] = "int";
- FIELD_TYPE_NAMES[LONG] = "long";
- FIELD_TYPE_NAMES[BOOLEAN] = "boolean";
- FIELD_TYPE_NAMES[FLOAT] = "float";
- FIELD_TYPE_NAMES[DOUBLE] = "double";
- FIELD_TYPE_NAMES[CHAR] = "char";
- FIELD_TYPE_NAMES[UUID] = "UUID";
- FIELD_TYPE_NAMES[DECIMAL] = "decimal";
- FIELD_TYPE_NAMES[STRING] = "String";
- FIELD_TYPE_NAMES[DATE] = "Date";
- FIELD_TYPE_NAMES[TIMESTAMP] = "Timestamp";
- FIELD_TYPE_NAMES[ENUM] = "Enum";
- FIELD_TYPE_NAMES[OBJ] = "Object";
- FIELD_TYPE_NAMES[PORTABLE_OBJ] = "Object";
- FIELD_TYPE_NAMES[COL] = "Collection";
- FIELD_TYPE_NAMES[MAP] = "Map";
- FIELD_TYPE_NAMES[MAP_ENTRY] = "Entry";
- FIELD_TYPE_NAMES[CLASS] = "Class";
- FIELD_TYPE_NAMES[BYTE_ARR] = "byte[]";
- FIELD_TYPE_NAMES[SHORT_ARR] = "short[]";
- FIELD_TYPE_NAMES[INT_ARR] = "int[]";
- FIELD_TYPE_NAMES[LONG_ARR] = "long[]";
- FIELD_TYPE_NAMES[BOOLEAN_ARR] = "boolean[]";
- FIELD_TYPE_NAMES[FLOAT_ARR] = "float[]";
- FIELD_TYPE_NAMES[DOUBLE_ARR] = "double[]";
- FIELD_TYPE_NAMES[CHAR_ARR] = "char[]";
- FIELD_TYPE_NAMES[UUID_ARR] = "UUID[]";
- FIELD_TYPE_NAMES[DECIMAL_ARR] = "decimal[]";
- FIELD_TYPE_NAMES[STRING_ARR] = "String[]";
- FIELD_TYPE_NAMES[DATE_ARR] = "Date[]";
- FIELD_TYPE_NAMES[TIMESTAMP_ARR] = "Timestamp[]";
- FIELD_TYPE_NAMES[OBJ_ARR] = "Object[]";
- FIELD_TYPE_NAMES[ENUM_ARR] = "Enum[]";
- }
-
- /**
- * @param typeName Field type name.
- * @return Field type ID;
- */
- @SuppressWarnings("StringEquality")
- public static int fieldTypeId(String typeName) {
- for (int i = 0; i < FIELD_TYPE_NAMES.length; i++) {
- String typeName0 = FIELD_TYPE_NAMES[i];
-
- if (typeName.equals(typeName0))
- return i;
- }
-
- throw new IllegalArgumentException("Invalid metadata type name: " + typeName);
- }
-
- /**
- * @param typeId Field type ID.
- * @return Field type name.
- */
- public static String fieldTypeName(int typeId) {
- assert typeId >= 0 && typeId < FIELD_TYPE_NAMES.length : typeId;
-
- String typeName = FIELD_TYPE_NAMES[typeId];
-
- assert typeName != null : typeId;
-
- return typeName;
- }
-
- /**
- * @param typeIds Field type IDs.
- * @return Field type names.
- */
- public static Map<String, String> fieldTypeNames(Map<String, Integer> typeIds) {
- Map<String, String> names = U.newHashMap(typeIds.size());
-
- for (Map.Entry<String, Integer> e : typeIds.entrySet())
- names.put(e.getKey(), fieldTypeName(e.getValue()));
-
- return names;
- }
-
- /**
* @param ctx Kernal context.
*/
public CacheObjectBinaryProcessorImpl(GridKernalContext ctx) {
@@ -275,28 +153,31 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
clientNode = this.ctx.clientNode();
- clientMetaDataCache = clientNode ? new ConcurrentHashMap8<PortableMetaDataKey, BinaryType>() : null;
+ clientMetaDataCache = clientNode ? new ConcurrentHashMap8<Integer, BinaryTypeImpl>() : null;
}
/** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException {
if (marsh instanceof PortableMarshaller) {
- PortableMetaDataHandler metaHnd = new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType newMeta)
- throws BinaryObjectException {
+ BinaryMetadataHandler metaHnd = new BinaryMetadataHandler() {
+ @Override public void addMeta(int typeId, BinaryType newMeta) throws BinaryObjectException {
+ assert newMeta != null;
+ assert newMeta instanceof BinaryTypeImpl;
+
+ BinaryMetadata newMeta0 = ((BinaryTypeImpl)newMeta).metadata();
+
if (metaDataCache == null) {
- BinaryType oldMeta = metaBuf.get(typeId);
+ BinaryMetadata oldMeta = metaBuf.get(typeId);
- if (oldMeta == null || checkMeta(typeId, oldMeta, newMeta, null)) {
+ if (oldMeta == null || checkMeta(typeId, oldMeta, newMeta0, null)) {
synchronized (this) {
- Map<String, String> fields = new HashMap<>();
+ Map<String, Integer> fields = new HashMap<>();
- if (checkMeta(typeId, oldMeta, newMeta, fields)) {
- newMeta = new BinaryMetaDataImpl(newMeta.typeName(),
- fields,
- newMeta.affinityKeyFieldName());
+ if (checkMeta(typeId, oldMeta, newMeta0, fields)) {
+ newMeta0 = new BinaryMetadata(typeId, newMeta0.typeName(), fields,
+ newMeta0.affinityKeyFieldName());
- metaBuf.put(typeId, newMeta);
+ metaBuf.put(typeId, newMeta0);
}
else
return;
@@ -311,7 +192,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
return;
}
- CacheObjectBinaryProcessorImpl.this.addMeta(typeId, newMeta);
+ CacheObjectBinaryProcessorImpl.this.addMeta(typeId, newMeta0.wrap(portableCtx));
}
@Override public BinaryType metadata(int typeId) throws BinaryObjectException {
@@ -357,7 +238,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
GridCacheQueryManager qryMgr = metaDataCache.context().queries();
- CacheQuery<Map.Entry<PortableMetaDataKey, BinaryType>> qry =
+ CacheQuery<Map.Entry<PortableMetadataKey, BinaryMetadata>> qry =
qryMgr.createScanQuery(new MetaDataPredicate(), null, false);
qry.keepAll(false);
@@ -365,9 +246,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
qry.projection(ctx.cluster().get().forNode(oldestSrvNode));
try {
- CacheQueryFuture<Map.Entry<PortableMetaDataKey, BinaryType>> fut = qry.execute();
+ CacheQueryFuture<Map.Entry<PortableMetadataKey, BinaryMetadata>> fut = qry.execute();
- Map.Entry<PortableMetaDataKey, BinaryType> next;
+ Map.Entry<PortableMetadataKey, BinaryMetadata> next;
while ((next = fut.next()) != null) {
assert next.getKey() != null : next;
@@ -395,8 +276,8 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
startLatch.countDown();
- for (Map.Entry<Integer, BinaryType> e : metaBuf.entrySet())
- addMeta(e.getKey(), e.getValue());
+ for (Map.Entry<Integer, BinaryMetadata> e : metaBuf.entrySet())
+ addMeta(e.getKey(), e.getValue().wrap(portableCtx));
metaBuf.clear();
}
@@ -413,20 +294,24 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
* @param key Metadata key.
* @param newMeta Metadata.
*/
- private void addClientCacheMetaData(PortableMetaDataKey key, final BinaryType newMeta) {
- clientMetaDataCache.compute(key,
- new ConcurrentHashMap8.BiFun<PortableMetaDataKey, BinaryType, BinaryType>() {
- @Override public BinaryType apply(PortableMetaDataKey key, BinaryType oldMeta) {
- BinaryType res;
+ private void addClientCacheMetaData(PortableMetadataKey key, final BinaryMetadata newMeta) {
+ int key0 = key.typeId();
+
+ clientMetaDataCache.compute(key0,
+ new ConcurrentHashMap8.BiFun<Integer, BinaryTypeImpl, BinaryTypeImpl>() {
+ @Override public BinaryTypeImpl apply(Integer key, BinaryTypeImpl oldMeta) {
+ BinaryMetadata res;
+
+ BinaryMetadata oldMeta0 = oldMeta != null ? oldMeta.metadata() : null;
try {
- res = checkMeta(key.typeId(), oldMeta, newMeta, null) ? newMeta : oldMeta;
+ res = checkMeta(key, oldMeta0, newMeta, null) ? newMeta : oldMeta0;
}
catch (BinaryObjectException e) {
- res = oldMeta;
+ res = oldMeta0;
}
- return res;
+ return res != null ? res.wrap(portableCtx) : null;
}
}
);
@@ -480,6 +365,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Override public Object marshalToPortable(@Nullable Object obj) throws BinaryObjectException {
if (obj == null)
return null;
@@ -564,21 +450,23 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public void updateMetaData(int typeId, String typeName, @Nullable String affKeyFieldName,
Map<String, Integer> fieldTypeIds) throws BinaryObjectException {
- portableCtx.updateMetaData(typeId,
- new BinaryMetaDataImpl(typeName, fieldTypeNames(fieldTypeIds), affKeyFieldName));
+ portableCtx.updateMetaData(typeId, new BinaryMetadata(typeId, typeName, fieldTypeIds, affKeyFieldName));
}
/** {@inheritDoc} */
@Override public void addMeta(final int typeId, final BinaryType newMeta) throws BinaryObjectException {
assert newMeta != null;
+ assert newMeta instanceof BinaryTypeImpl;
+
+ BinaryMetadata newMeta0 = ((BinaryTypeImpl)newMeta).metadata();
- final PortableMetaDataKey key = new PortableMetaDataKey(typeId);
+ final PortableMetadataKey key = new PortableMetadataKey(typeId);
try {
- BinaryType oldMeta = metaDataCache.localPeek(key);
+ BinaryMetadata oldMeta = metaDataCache.localPeek(key);
- if (oldMeta == null || checkMeta(typeId, oldMeta, newMeta, null)) {
- BinaryObjectException err = metaDataCache.invoke(key, new MetaDataProcessor(typeId, newMeta));
+ if (oldMeta == null || checkMeta(typeId, oldMeta, newMeta0, null)) {
+ BinaryObjectException err = metaDataCache.invoke(key, new MetaDataProcessor(typeId, newMeta0));
if (err != null)
throw err;
@@ -593,9 +481,12 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
@Nullable @Override public BinaryType metadata(final int typeId) throws BinaryObjectException {
try {
if (clientNode)
- return clientMetaDataCache.get(new PortableMetaDataKey(typeId));
+ return clientMetaDataCache.get(typeId);
+ else {
+ BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey(typeId));
- return metaDataCache.localPeek(new PortableMetaDataKey(typeId));
+ return meta != null ? meta.wrap(portableCtx) : null;
+ }
}
catch (CacheException e) {
throw new BinaryObjectException(e);
@@ -606,17 +497,17 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
@Override public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds)
throws BinaryObjectException {
try {
- Collection<PortableMetaDataKey> keys = new ArrayList<>(typeIds.size());
+ Collection<PortableMetadataKey> keys = new ArrayList<>(typeIds.size());
for (Integer typeId : typeIds)
- keys.add(new PortableMetaDataKey(typeId));
+ keys.add(new PortableMetadataKey(typeId));
- Map<PortableMetaDataKey, BinaryType> meta = metaDataCache.getAll(keys);
+ Map<PortableMetadataKey, BinaryMetadata> meta = metaDataCache.getAll(keys);
Map<Integer, BinaryType> res = U.newHashMap(meta.size());
- for (Map.Entry<PortableMetaDataKey, BinaryType> e : meta.entrySet())
- res.put(e.getKey().typeId(), e.getValue());
+ for (Map.Entry<PortableMetadataKey, BinaryMetadata> e : meta.entrySet())
+ res.put(e.getKey().typeId(), e.getValue().wrap(portableCtx));
return res;
}
@@ -629,17 +520,21 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
@SuppressWarnings("unchecked")
@Override public Collection<BinaryType> metadata() throws BinaryObjectException {
if (clientNode)
- return new ArrayList<>(clientMetaDataCache.values());
-
- return F.viewReadOnly(metaDataCache.entrySetx(metaPred),
- new C1<Cache.Entry<PortableMetaDataKey, BinaryType>, BinaryType>() {
- private static final long serialVersionUID = 0L;
-
- @Override public BinaryType apply(
- Cache.Entry<PortableMetaDataKey, BinaryType> e) {
- return e.getValue();
+ return F.viewReadOnly(clientMetaDataCache.values(), new IgniteClosure<BinaryTypeImpl, BinaryType>() {
+ @Override public BinaryType apply(BinaryTypeImpl meta) {
+ return meta;
}
});
+ else {
+ return F.viewReadOnly(metaDataCache.entrySetx(metaPred),
+ new C1<Cache.Entry<PortableMetadataKey, BinaryMetadata>, BinaryType>() {
+ private static final long serialVersionUID = 0L;
+
+ @Override public BinaryType apply(Cache.Entry<PortableMetadataKey, BinaryMetadata> e) {
+ return e.getValue().wrap(portableCtx);
+ }
+ });
+ }
}
/** {@inheritDoc} */
@@ -839,12 +734,12 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
* @return Whether meta is changed.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
- private static boolean checkMeta(int typeId, @Nullable BinaryType oldMeta,
- BinaryType newMeta, @Nullable Map<String, String> fields) throws BinaryObjectException {
+ private static boolean checkMeta(int typeId, @Nullable BinaryMetadata oldMeta,
+ BinaryMetadata newMeta, @Nullable Map<String, Integer> fields) throws BinaryObjectException {
assert newMeta != null;
- Map<String, String> oldFields = oldMeta != null ? ((BinaryMetaDataImpl)oldMeta).fieldsMeta() : null;
- Map<String, String> newFields = ((BinaryMetaDataImpl)newMeta).fieldsMeta();
+ Map<String, Integer> oldFields = oldMeta != null ? oldMeta.fieldsMap() : null;
+ Map<String, Integer> newFields = newMeta.fieldsMap();
boolean changed = false;
@@ -875,17 +770,17 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
else
changed = true;
- for (Map.Entry<String, String> e : newFields.entrySet()) {
- String typeName = oldFields != null ? oldFields.get(e.getKey()) : null;
+ for (Map.Entry<String, Integer> e : newFields.entrySet()) {
+ Integer oldTypeId = oldFields != null ? oldFields.get(e.getKey()) : null;
- if (typeName != null) {
- if (!typeName.equals(e.getValue())) {
+ if (oldTypeId != null) {
+ if (!oldTypeId.equals(e.getValue())) {
throw new BinaryObjectException(
"Portable field has different types on different clients [" +
"typeName=" + newMeta.typeName() +
", fieldName=" + e.getKey() +
- ", fieldTypeName1=" + typeName +
- ", fieldTypeName2=" + e.getValue() +
+ ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldTypeId) +
+ ", fieldTypeName2=" + PortableUtils.fieldTypeName(e.getValue()) +
']'
);
}
@@ -904,7 +799,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/**
*/
private static class MetaDataProcessor implements
- EntryProcessor<PortableMetaDataKey, BinaryType, BinaryObjectException>, Externalizable {
+ EntryProcessor<PortableMetadataKey, BinaryMetadata, BinaryObjectException>, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -912,7 +807,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private int typeId;
/** */
- private BinaryType newMeta;
+ private BinaryMetadata newMeta;
/**
* For {@link Externalizable}.
@@ -925,7 +820,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
* @param typeId Type ID.
* @param newMeta New metadata.
*/
- private MetaDataProcessor(int typeId, BinaryType newMeta) {
+ private MetaDataProcessor(int typeId, BinaryMetadata newMeta) {
assert newMeta != null;
this.typeId = typeId;
@@ -934,16 +829,15 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public BinaryObjectException process(
- MutableEntry<PortableMetaDataKey, BinaryType> entry,
+ MutableEntry<PortableMetadataKey, BinaryMetadata> entry,
Object... args) {
try {
- BinaryType oldMeta = entry.getValue();
+ BinaryMetadata oldMeta = entry.getValue();
- Map<String, String> fields = new HashMap<>();
+ Map<String, Integer> fields = new HashMap<>();
if (checkMeta(typeId, oldMeta, newMeta, fields)) {
- BinaryType res = new BinaryMetaDataImpl(newMeta.typeName(),
- fields,
+ BinaryMetadata res = new BinaryMetadata(typeId, newMeta.typeName(), fields,
newMeta.affinityKeyFieldName());
entry.setValue(res);
@@ -967,7 +861,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
typeId = in.readInt();
- newMeta = (BinaryType)in.readObject();
+ newMeta = (BinaryMetadata)in.readObject();
}
/** {@inheritDoc} */
@@ -979,17 +873,17 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/**
*
*/
- class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetaDataKey, BinaryType> {
+ class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey, BinaryMetadata> {
/** {@inheritDoc} */
@Override public void onUpdated(
- Iterable<CacheEntryEvent<? extends PortableMetaDataKey, ? extends BinaryType>> evts)
+ Iterable<CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata>> evts)
throws CacheEntryListenerException {
- for (CacheEntryEvent<? extends PortableMetaDataKey, ? extends BinaryType> evt : evts) {
+ for (CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata> evt : evts) {
assert evt.getEventType() == EventType.CREATED || evt.getEventType() == EventType.UPDATED : evt;
- PortableMetaDataKey key = evt.getKey();
+ PortableMetadataKey key = evt.getKey();
- final BinaryType newMeta = evt.getValue();
+ final BinaryMetadata newMeta = evt.getValue();
assert newMeta != null : evt;
@@ -1012,7 +906,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public boolean evaluate(CacheEntryEvent<?, ?> evt) throws CacheEntryListenerException {
- return evt.getKey() instanceof PortableMetaDataKey;
+ return evt.getKey() instanceof PortableMetadataKey;
}
/** {@inheritDoc} */
@@ -1030,7 +924,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public boolean apply(Object key, Object val) {
- return key instanceof PortableMetaDataKey;
+ return key instanceof PortableMetadataKey;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
index 2a98778..f838c82 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Key for portable meta data.
*/
-class PortableMetaDataKey extends GridCacheUtilityKey<PortableMetaDataKey> implements Externalizable {
+class PortableMetadataKey extends GridCacheUtilityKey<PortableMetadataKey> implements Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -37,14 +37,14 @@ class PortableMetaDataKey extends GridCacheUtilityKey<PortableMetaDataKey> imple
/**
* For {@link Externalizable}.
*/
- public PortableMetaDataKey() {
+ public PortableMetadataKey() {
// No-op.
}
/**
* @param typeId Type ID.
*/
- PortableMetaDataKey(int typeId) {
+ PortableMetadataKey(int typeId) {
this.typeId = typeId;
}
@@ -66,7 +66,7 @@ class PortableMetaDataKey extends GridCacheUtilityKey<PortableMetaDataKey> imple
}
/** {@inheritDoc} */
- @Override protected boolean equalsx(PortableMetaDataKey key) {
+ @Override protected boolean equalsx(PortableMetadataKey key) {
return typeId == key.typeId;
}
@@ -77,6 +77,6 @@ class PortableMetaDataKey extends GridCacheUtilityKey<PortableMetaDataKey> imple
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(PortableMetaDataKey.class, this);
+ return S.toString(PortableMetadataKey.class, this);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index c513600..05d3515 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -34,7 +34,7 @@ import org.apache.ignite.events.SwapSpaceEvent;
import org.apache.ignite.events.TaskEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.BinaryMetaDataImpl;
+import org.apache.ignite.internal.portable.BinaryMetadata;
import org.apache.ignite.internal.portable.BinaryRawReaderEx;
import org.apache.ignite.internal.portable.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
@@ -68,7 +68,6 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformReaderClosur
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
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.binary.BinaryType;
import org.jetbrains.annotations.Nullable;
@@ -391,12 +390,7 @@ public class PlatformContextImpl implements PlatformContext {
else {
writer.writeBoolean(true);
- Map<String, String> metaFields = ((BinaryMetaDataImpl)meta).fields0();
-
- Map<String, Integer> fields = U.newHashMap(metaFields.size());
-
- for (Map.Entry<String, String> metaField : metaFields.entrySet())
- fields.put(metaField.getKey(), CacheObjectBinaryProcessorImpl.fieldTypeId(metaField.getValue()));
+ Map<String, Integer> fields = ((BinaryMetadata)meta).fieldsMap();
writer.writeInt(typeId);
writer.writeString(meta.typeName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index 60c0693..d0462e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -22,10 +22,10 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.PlatformConfiguration;
import org.apache.ignite.internal.MarshallerContextImpl;
+import org.apache.ignite.internal.portable.BinaryNoopMetadataHandler;
+import org.apache.ignite.internal.portable.BinaryRawWriterEx;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.internal.portable.PortableMetaDataHandler;
-import org.apache.ignite.internal.portable.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure;
import org.apache.ignite.internal.processors.platform.lifecycle.PlatformLifecycleBean;
import org.apache.ignite.internal.processors.platform.memory.PlatformInputStream;
@@ -36,11 +36,9 @@ 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.platform.dotnet.PlatformDotNetConfiguration;
import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration;
import org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryType;
import java.util.ArrayList;
import java.util.Collections;
@@ -228,16 +226,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
@SuppressWarnings("deprecation")
private static GridPortableMarshaller marshaller() {
try {
- PortableContext ctx = new PortableContext(new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType meta)
- throws BinaryObjectException {
- // No-op.
- }
-
- @Override public BinaryType metadata(int typeId) throws BinaryObjectException {
- return null;
- }
- }, new IgniteConfiguration());
+ PortableContext ctx = new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration());
PortableMarshaller marsh = new PortableMarshaller();
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index c4deaa0..4d1145d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1875,7 +1875,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (field0 == null)
{
- field0 = obj.fieldDescriptor(propName);
+ field0 = obj.type().field(propName);
assert field0 != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
index 4fa80b4..14fc6f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
@@ -17,15 +17,14 @@
package org.apache.ignite.internal.portable;
+import org.apache.ignite.binary.BinaryField;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerContextTestImpl;
import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.binary.BinaryField;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import java.math.BigDecimal;
@@ -38,17 +37,6 @@ import java.util.UUID;
* Contains tests for portable object fields.
*/
public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTest {
- /** Dummy metadata handler. */
- protected static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType meta) {
- // No-op.
- }
-
- @Override public BinaryType metadata(int typeId) {
- return null;
- }
- };
-
/** Marshaller. */
protected PortableMarshaller dfltMarsh;
@@ -59,7 +47,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes
* @throws Exception If failed.
*/
protected static PortableMarshaller createMarshaller() throws Exception {
- PortableContext ctx = new PortableContext(META_HND, new IgniteConfiguration());
+ PortableContext ctx = new PortableContext(new TestCachingMetadataHandler(), new IgniteConfiguration());
PortableMarshaller marsh = new PortableMarshaller();
@@ -485,7 +473,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes
BinaryObjectEx portObj = toPortable(marsh, obj);
- BinaryField field = portObj.fieldDescriptor(fieldName);
+ BinaryField field = portObj.type().field(fieldName);
return new TestContext(obj, portObj, field);
}
@@ -508,7 +496,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes
assert portObj != null;
- BinaryField field = portObj.fieldDescriptor(fieldName);
+ BinaryField field = portObj.type().field(fieldName);
return new TestContext(obj, portObj, field);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
index e62d12e..11b54ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
@@ -998,7 +998,7 @@ public class GridBinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstrac
BinaryType metadata = portables().metadata(c.getClass());
- assertTrue(metadata.fields().containsAll(Arrays.asList("intField", "intArrField", "arrField", "strField",
+ assertTrue(metadata.fieldNames().containsAll(Arrays.asList("intField", "intArrField", "arrField", "strField",
"colField", "mapField", "enumField", "enumArrField")));
assertEquals("int", metadata.fieldTypeName("intField"));
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
index ccebd73..a74315b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
@@ -789,7 +789,7 @@ public class GridBinaryObjectBuilderSelfTest extends GridCommonAbstractTest {
assertEquals("MetaTest", meta.typeName());
- Collection<String> fields = meta.fields();
+ Collection<String> fields = meta.fieldNames();
assertEquals(2, fields.size());
@@ -812,7 +812,7 @@ public class GridBinaryObjectBuilderSelfTest extends GridCommonAbstractTest {
assertEquals("MetaTest", meta.typeName());
- fields = meta.fields();
+ fields = meta.fieldNames();
assertEquals(3, fields.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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
index ee91167..747f8ea 100644
--- 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
@@ -17,38 +17,27 @@
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.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.MarshallerContextAdapter;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+
/**
*
*/
public class GridPortableMarshallerCtxDisabledSelfTest extends GridCommonAbstractTest {
- /** */
- protected static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType meta) {
- // No-op.
- }
-
- @Override public BinaryType metadata(int typeId) {
- return null;
- }
- };
-
/**
* @throws Exception If failed.
*/
@@ -56,7 +45,7 @@ public class GridPortableMarshallerCtxDisabledSelfTest extends GridCommonAbstrac
PortableMarshaller marsh = new PortableMarshaller();
marsh.setContext(new MarshallerContextWithNoStorage());
- PortableContext context = new PortableContext(META_HND, new IgniteConfiguration());
+ PortableContext context = new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration());
IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", context);
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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
index b5a24b1..d0a5709 100644
--- 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
@@ -82,17 +82,6 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
/** */
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, BinaryType meta) {
- // No-op.
- }
-
- @Override public BinaryType metadata(int typeId) {
- return null;
- }
- };
-
/**
* @throws Exception If failed.
*/
@@ -2414,7 +2403,7 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
protected PortableContext initPortableContext(PortableMarshaller marsh) throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration();
- PortableContext ctx = new PortableContext(META_HND, iCfg);
+ PortableContext ctx = new PortableContext(BinaryNoopMetadataHandler.instance(), iCfg);
marsh.setContext(new MarshallerContextTestImpl(null));
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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
index c0e2563..2a367a8 100644
--- 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
@@ -93,7 +93,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
switch (meta.typeName()) {
case "TestObject1":
- fields = meta.fields();
+ fields = meta.fieldNames();
assertEquals(7, fields.size());
@@ -116,7 +116,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
break;
case "TestObject2":
- fields = meta.fields();
+ fields = meta.fieldNames();
assertEquals(7, fields.size());
@@ -165,7 +165,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
assertEquals("TestObject1", meta.typeName());
- Collection<String> fields = meta.fields();
+ Collection<String> fields = meta.fieldNames();
assertEquals(7, fields.size());
@@ -198,7 +198,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
assertEquals("TestObject2", meta.typeName());
- Collection<String> fields = meta.fields();
+ Collection<String> fields = meta.fieldNames();
assertEquals(7, fields.size());
@@ -235,7 +235,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
assertEquals("TestObject2", meta.typeName());
- Collection<String> fields = meta.fields();
+ Collection<String> fields = meta.fieldNames();
assertEquals(9, fields.size());
@@ -284,7 +284,7 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
assertEquals("TestObject1", meta.typeName());
- Collection<String> fields = meta.fields();
+ Collection<String> fields = meta.fieldNames();
assertEquals(7, fields.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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
index 7522bf9..52af867 100644
--- 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
@@ -17,37 +17,26 @@
package org.apache.ignite.internal.portable;
-import java.util.Arrays;
-import java.util.Map;
+import org.apache.ignite.binary.BinaryIdMapper;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
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.binary.BinaryIdMapper;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import java.util.Arrays;
+import java.util.Map;
+
/**
* Wildcards test.
*/
public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest {
- /** */
- private static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType meta) {
- // No-op.
- }
-
- @Override public BinaryType metadata(int typeId) {
- return null;
- }
- };
-
/**
* @return Portable context.
*/
private PortableContext portableContext() {
- return new PortableContext(META_HND, new IgniteConfiguration());
+ return new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java
index db3c821..9225b97 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/PortableCompactOffsetsAbstractSelfTest.java
@@ -17,9 +17,7 @@
package org.apache.ignite.internal.portable;
-import java.util.Arrays;
import org.apache.ignite.binary.BinaryField;
-import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -27,6 +25,8 @@ import org.apache.ignite.marshaller.MarshallerContextTestImpl;
import org.apache.ignite.marshaller.portable.PortableMarshaller;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import java.util.Arrays;
+
/**
* Contains tests for compact offsets.
*/
@@ -37,17 +37,6 @@ public abstract class PortableCompactOffsetsAbstractSelfTest extends GridCommonA
/** 2 pow 16. */
private static int POW_16 = 1 << 16;
- /** Dummy metadata handler. */
- protected static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType meta) {
- // No-op.
- }
-
- @Override public BinaryType metadata(int typeId) {
- return null;
- }
- };
-
/** Marshaller. */
protected PortableMarshaller marsh;
@@ -58,7 +47,7 @@ public abstract class PortableCompactOffsetsAbstractSelfTest extends GridCommonA
@Override protected void beforeTest() throws Exception {
super.beforeTest();
- ctx = new PortableContext(META_HND, new IgniteConfiguration());
+ ctx = new PortableContext(new TestCachingMetadataHandler(), new IgniteConfiguration());
marsh = new PortableMarshaller();
@@ -139,8 +128,8 @@ public abstract class PortableCompactOffsetsAbstractSelfTest extends GridCommonA
assert obj.field2 == field2;
// 2. Test fields API.
- BinaryField field1Desc = portObj.fieldDescriptor("field1");
- BinaryField field2Desc = portObj.fieldDescriptor("field2");
+ BinaryField field1Desc = portObj.type().field("field1");
+ BinaryField field2Desc = portObj.type().field("field2");
assert field1Desc.exists(portObj);
assert field2Desc.exists(portObj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
new file mode 100644
index 0000000..e49ebf3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Test metadata handler.
+ */
+public class TestCachingMetadataHandler implements BinaryMetadataHandler {
+ /** Cached metadatas. */
+ private final ConcurrentHashMap<Integer, BinaryType> metas = new ConcurrentHashMap<>();
+
+ /** {@inheritDoc} */
+ @Override public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException {
+ BinaryType otherType = metas.put(typeId, meta);
+
+ if (otherType != null)
+ throw new IllegalStateException("Metadata replacement is not allowed in " +
+ TestCachingMetadataHandler.class.getSimpleName() + '.');
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryType metadata(int typeId) throws BinaryObjectException {
+ return metas.get(typeId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
index a33eb7b..d19c1ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
@@ -169,7 +169,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
assertNull(meta.affinityKeyFieldName());
- assertEquals(10, meta.fields().size());
+ assertEquals(10, meta.fieldNames().size());
}
assertEquals(allTypes.size(), names.size());
@@ -255,7 +255,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
assertNull(meta.affinityKeyFieldName());
- assertEquals(1, meta.fields().size());
+ assertEquals(1, meta.fieldNames().size());
}
assertEquals(1000, names.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataTest.java
index b20adb8..10c06a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodeBinaryObjectMetadataTest.java
@@ -20,7 +20,6 @@ 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.CacheKeyConfiguration;
import org.apache.ignite.cache.CacheMode;
@@ -29,9 +28,7 @@ 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.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -127,7 +124,7 @@ public class GridCacheClientNodeBinaryObjectMetadataTest extends GridCacheAbstra
for (BinaryType m2 : meta1) {
if (m1.typeName().equals(m2.typeName())) {
assertEquals(m1.affinityKeyFieldName(), m2.affinityKeyFieldName());
- assertEquals(m1.fields(), m2.fields());
+ assertEquals(m1.fieldNames(), m2.fieldNames());
found = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/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
index d277801..2e868da 100644
--- 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
@@ -19,15 +19,13 @@ package org.apache.ignite.internal.processors.cache.portable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.portable.BinaryNoopMetadataHandler;
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.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryType;
/**
*
@@ -39,15 +37,7 @@ public class GridPortableCacheEntryMemorySizeSelfTest extends GridCacheEntryMemo
marsh.setContext(new MarshallerContextTestImpl(null));
- PortableContext pCtx = new PortableContext(new PortableMetaDataHandler() {
- @Override public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException {
- // No-op
- }
-
- @Override public BinaryType metadata(int typeId) throws BinaryObjectException {
- return null;
- }
- }, new IgniteConfiguration());
+ PortableContext pCtx = new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration());
IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", pCtx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/63d55062/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
index 77c7e3a..8eba80b 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
@@ -94,7 +94,7 @@ public class PlatformComputeBinarizableArgTask extends ComputeTaskAdapter<Object
if (meta == null)
throw new IgniteException("Metadata doesn't exist.");
- if (meta.fields() == null || !meta.fields().contains("Field"))
+ if (meta.fieldNames() == null || !meta.fieldNames().contains("Field"))
throw new IgniteException("Field metadata doesn't exist.");
if (!F.eq("int", meta.fieldTypeName("Field")))
[07/50] [abbrv] ignite git commit: IGNITE-1681: Dogpile effect tests
for CacheStoreBalancingWrapper
Posted by vo...@apache.org.
IGNITE-1681: Dogpile effect tests for CacheStoreBalancingWrapper
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d70f7eda
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d70f7eda
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d70f7eda
Branch: refs/heads/ignite-1816
Commit: d70f7eda0492857ffd4879c311c814867552070e
Parents: 7ba2efb
Author: Andrey Gura <ag...@gridgain.com>
Authored: Tue Nov 10 13:59:38 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Nov 10 13:59:38 2015 +0300
----------------------------------------------------------------------
.../store/GridCacheBalancingStoreSelfTest.java | 181 ++++++++++++++++++-
1 file changed, 180 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d70f7eda/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
index d41a441..1e3e4b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
@@ -17,10 +17,14 @@
package org.apache.ignite.cache.store;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -29,8 +33,10 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.cache.Cache;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.cache.CacheStoreBalancingWrapper;
import org.apache.ignite.internal.util.typedef.CI2;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.testframework.GridTestUtils;
@@ -118,6 +124,81 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentLoad() throws Exception {
+ int threads = 5;
+
+ final int keys = 50;
+
+ final CyclicBarrier beforeBarrier = new CyclicBarrier(threads);
+
+ ConcurrentVerifyStore store = new ConcurrentVerifyStore(keys);
+
+ final CacheStoreBalancingWrapper<Integer, Integer> wrapper =new CacheStoreBalancingWrapper<>(store);
+
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ for (int i = 0; i < keys; i++) {
+ try {
+ beforeBarrier.await();
+ }
+ catch (InterruptedException | BrokenBarrierException e) {
+ throw new RuntimeException(e);
+ }
+
+ info("Load key: " + i);
+
+ wrapper.load(i);
+ }
+ }
+ }, threads, "load-thread");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentLoadAll() throws Exception {
+ int threads = 5;
+
+ final int threshold = 5;
+
+ final int keysCnt = 100;
+
+ final CyclicBarrier beforeBarrier = new CyclicBarrier(threads);
+
+ ConcurrentVerifyStore store = new ConcurrentVerifyStore(keysCnt);
+
+ final CacheStoreBalancingWrapper<Integer, Integer> wrapper = new CacheStoreBalancingWrapper<>(store);
+
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ for (int i = 0; i < keysCnt; i += threshold) {
+ try {
+ beforeBarrier.await();
+ }
+ catch (InterruptedException | BrokenBarrierException e) {
+ throw new RuntimeException(e);
+ }
+
+ List<Integer> keys = new ArrayList<>(threshold);
+
+ for (int j = i; j < i + threshold; j++)
+ keys.add(j);
+
+ info("Load keys: " + keys);
+
+ wrapper.loadAll(keys, new IgniteBiInClosure<Integer, Integer>() {
+ @Override public void apply(Integer integer, Integer integer2) {
+ // No-op.
+ }
+ });
+ }
+ }
+ }, threads, "load-thread");
+ }
+
+ /**
*
*/
private static class VerifyStore implements CacheStore<Integer, Integer> {
@@ -204,4 +285,102 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
// No-op.
}
}
-}
\ No newline at end of file
+
+ /**
+ *
+ */
+ private static class ConcurrentVerifyStore implements CacheStore<Integer, Integer> {
+
+ /** Cnts. */
+ private final AtomicInteger[] cnts;
+
+ /**
+ */
+ private ConcurrentVerifyStore(int keys) {
+ this.cnts = new AtomicInteger[keys];
+
+ for (int i = 0; i < keys; i++)
+ cnts[i] = new AtomicInteger();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Integer load(Integer key) {
+ try {
+ U.sleep(500);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ throw new RuntimeException(e);
+ }
+
+ assertEquals("Redundant load call.", 1, cnts[key].incrementAndGet());
+
+ return key;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void loadCache(IgniteBiInClosure<Integer, Integer> clo, @Nullable Object... args) {
+ // No-op.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Map<Integer, Integer> loadAll(Iterable<? extends Integer> keys) {
+ try {
+ U.sleep(500);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ e.printStackTrace();
+ }
+
+ Map<Integer, Integer> loaded = new HashMap<>();
+
+ for (Integer key : keys) {
+ assertEquals("Redundant loadAll call.", 1, cnts[key].incrementAndGet());
+
+ loaded.put(key, key);
+ }
+
+ return loaded;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry) {
+ // No-op.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void writeAll(Collection<Cache.Entry<? extends Integer, ? extends Integer>> entries) {
+ // No-op.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void delete(Object key) {
+ // No-op.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void deleteAll(Collection<?> keys) {
+ // No-op.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void sessionEnd(boolean commit) {
+ // No-op.
+ }
+ }
+}
[17/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6b158c9d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6b158c9d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6b158c9d
Branch: refs/heads/ignite-1816
Commit: 6b158c9ddf61159ce8f622832713e0bc508d1fb8
Parents: d567d259 388a892
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 11 10:20:22 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 11 10:20:22 2015 +0300
----------------------------------------------------------------------
.../cache/store/CacheStoreSessionListener.java | 9 +-
.../jdbc/CacheJdbcStoreSessionListener.java | 8 +-
.../GridCachePartitionExchangeManager.java | 34 ++--
.../dht/preloader/GridDhtPartitionDemander.java | 25 ++-
.../store/GridCacheStoreManagerAdapter.java | 26 ++-
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../org/apache/ignite/stream/StreamAdapter.java | 2 +-
.../store/GridCacheBalancingStoreSelfTest.java | 181 ++++++++++++++++++-
...CacheAtomicReferenceApiSelfAbstractTest.java | 20 +-
modules/rest-http/pom.xml | 11 ++
.../yardstick/config/ignite-store-config.xml | 31 ++--
modules/zookeeper/pom.xml | 2 +-
13 files changed, 293 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
[48/50] [abbrv] ignite git commit: IGNITE-1847: GIT failed to change
class name casing (1/2).
Posted by vo...@apache.org.
IGNITE-1847: GIT failed to change class name casing (1/2).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a0efe760
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a0efe760
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a0efe760
Branch: refs/heads/ignite-1816
Commit: a0efe76068eb6c802e5c228d9b5734722b82f5ad
Parents: 63d5506
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Nov 18 10:30:11 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 18 10:30:11 2015 +0300
----------------------------------------------------------------------
.../portable/BinaryMetaDataCollector.java | 254 -------------------
.../portable/BinaryMetadataCollector2.java | 254 +++++++++++++++++++
.../portable/PortableClassDescriptor.java | 2 +-
.../CacheObjectBinaryProcessorImpl.java | 44 ++--
.../cache/portable/PortableMetaDataKey.java | 82 ------
.../cache/portable/PortableMetadataKey2.java | 82 ++++++
6 files changed, 359 insertions(+), 359 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0efe760/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
deleted file mode 100644
index 67e1a0d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataCollector.java
+++ /dev/null
@@ -1,254 +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.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryWriter;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Writer for meta data collection.
- */
-class BinaryMetadataCollector implements BinaryWriter {
- /** */
- private final Map<String, Integer> meta = new HashMap<>();
-
- /** */
- private final String typeName;
-
- /**
- * @param typeName Type name.
- */
- BinaryMetadataCollector(String typeName) {
- this.typeName = typeName;
- }
-
- /**
- * @return Field meta data.
- */
- Map<String, Integer> meta() {
- return meta;
- }
-
- /** {@inheritDoc} */
- @Override public void writeByte(String fieldName, byte val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BYTE);
- }
-
- /** {@inheritDoc} */
- @Override public void writeShort(String fieldName, short val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.SHORT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeInt(String fieldName, int val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.INT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeLong(String fieldName, long val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.LONG);
- }
-
- /** {@inheritDoc} */
- @Override public void writeFloat(String fieldName, float val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.FLOAT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDouble(String fieldName, double val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DOUBLE);
- }
-
- /** {@inheritDoc} */
- @Override public void writeChar(String fieldName, char val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.CHAR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BOOLEAN);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DECIMAL);
- }
-
- /** {@inheritDoc} */
- @Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.STRING);
- }
-
- /** {@inheritDoc} */
- @Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.UUID);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DATE);
- }
-
- /** {@inheritDoc} */
- @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP);
- }
-
- /** {@inheritDoc} */
- @Override public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.ENUM);
- }
-
- /** {@inheritDoc} */
- @Override public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.OBJECT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.INT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.LONG_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.STRING_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.UUID_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DATE_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public <T> void writeCollection(String fieldName, @Nullable Collection<T> col)
- throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.COL);
- }
-
- /** {@inheritDoc} */
- @Override public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.MAP);
- }
-
- /** {@inheritDoc} */
- @Override public BinaryRawWriter rawWriter() {
- return (BinaryRawWriter)Proxy.newProxyInstance(getClass().getClassLoader(),
- new Class<?>[] { BinaryRawWriterEx.class },
- new InvocationHandler() {
- @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable {
- return null;
- }
- });
- }
-
- /**
- * @param name Field name.
- * @param mode Field mode.
- * @throws BinaryObjectException In case of error.
- */
- private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException {
- assert name != null;
-
- int fieldTypeId = mode.typeId();
-
- Integer oldFieldTypeId = meta.put(name, fieldTypeId);
-
- if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) {
- throw new BinaryObjectException(
- "Field is written twice with different types [" +
- "typeName=" + typeName +
- ", fieldName=" + name +
- ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) +
- ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) +
- ']'
- );
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0efe760/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java
new file mode 100644
index 0000000..701c619
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java
@@ -0,0 +1,254 @@
+/*
+ * 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.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryWriter;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Writer for meta data collection.
+ */
+class BinaryMetadataCollector2 implements BinaryWriter {
+ /** */
+ private final Map<String, Integer> meta = new HashMap<>();
+
+ /** */
+ private final String typeName;
+
+ /**
+ * @param typeName Type name.
+ */
+ BinaryMetadataCollector2(String typeName) {
+ this.typeName = typeName;
+ }
+
+ /**
+ * @return Field meta data.
+ */
+ Map<String, Integer> meta() {
+ return meta;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeByte(String fieldName, byte val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BYTE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeShort(String fieldName, short val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.SHORT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeInt(String fieldName, int val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.INT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeLong(String fieldName, long val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.LONG);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeFloat(String fieldName, float val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.FLOAT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDouble(String fieldName, double val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DOUBLE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeChar(String fieldName, char val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.CHAR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BOOLEAN);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DECIMAL);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.STRING);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.UUID);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DATE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.ENUM);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.OBJECT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.INT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.LONG_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.STRING_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.UUID_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DATE_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> void writeCollection(String fieldName, @Nullable Collection<T> col)
+ throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.COL);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.MAP);
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryRawWriter rawWriter() {
+ return (BinaryRawWriter)Proxy.newProxyInstance(getClass().getClassLoader(),
+ new Class<?>[] { BinaryRawWriterEx.class },
+ new InvocationHandler() {
+ @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable {
+ return null;
+ }
+ });
+ }
+
+ /**
+ * @param name Field name.
+ * @param mode Field mode.
+ * @throws BinaryObjectException In case of error.
+ */
+ private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException {
+ assert name != null;
+
+ int fieldTypeId = mode.typeId();
+
+ Integer oldFieldTypeId = meta.put(name, fieldTypeId);
+
+ if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) {
+ throw new BinaryObjectException(
+ "Field is written twice with different types [" +
+ "typeName=" + typeName +
+ ", fieldName=" + name +
+ ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) +
+ ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) +
+ ']'
+ );
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0efe760/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 225e0ba..7fa6bc3 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
@@ -546,7 +546,7 @@ public class PortableClassDescriptor {
if (obj.getClass() != BinaryMetadata.class
&& ctx.isMetaDataChanged(typeId, writer.metaDataHashSum())) {
- BinaryMetadataCollector metaCollector = new BinaryMetadataCollector(typeName);
+ BinaryMetadataCollector2 metaCollector = new BinaryMetadataCollector2(typeName);
if (serializer != null)
serializer.writeBinary(obj, metaCollector);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0efe760/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index 117eece..e6eb494 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -110,7 +110,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private final boolean clientNode;
/** */
- private volatile IgniteCacheProxy<PortableMetadataKey, BinaryMetadata> metaDataCache;
+ private volatile IgniteCacheProxy<PortableMetadataKey2, BinaryMetadata> metaDataCache;
/** */
private final ConcurrentHashMap8<Integer, BinaryTypeImpl> clientMetaDataCache;
@@ -120,7 +120,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private static final long serialVersionUID = 0L;
@Override public boolean apply(GridCacheEntryEx e) {
- return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey;
+ return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey2;
}
};
@@ -238,7 +238,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
GridCacheQueryManager qryMgr = metaDataCache.context().queries();
- CacheQuery<Map.Entry<PortableMetadataKey, BinaryMetadata>> qry =
+ CacheQuery<Map.Entry<PortableMetadataKey2, BinaryMetadata>> qry =
qryMgr.createScanQuery(new MetaDataPredicate(), null, false);
qry.keepAll(false);
@@ -246,9 +246,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
qry.projection(ctx.cluster().get().forNode(oldestSrvNode));
try {
- CacheQueryFuture<Map.Entry<PortableMetadataKey, BinaryMetadata>> fut = qry.execute();
+ CacheQueryFuture<Map.Entry<PortableMetadataKey2, BinaryMetadata>> fut = qry.execute();
- Map.Entry<PortableMetadataKey, BinaryMetadata> next;
+ Map.Entry<PortableMetadataKey2, BinaryMetadata> next;
while ((next = fut.next()) != null) {
assert next.getKey() != null : next;
@@ -294,7 +294,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
* @param key Metadata key.
* @param newMeta Metadata.
*/
- private void addClientCacheMetaData(PortableMetadataKey key, final BinaryMetadata newMeta) {
+ private void addClientCacheMetaData(PortableMetadataKey2 key, final BinaryMetadata newMeta) {
int key0 = key.typeId();
clientMetaDataCache.compute(key0,
@@ -460,7 +460,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
BinaryMetadata newMeta0 = ((BinaryTypeImpl)newMeta).metadata();
- final PortableMetadataKey key = new PortableMetadataKey(typeId);
+ final PortableMetadataKey2 key = new PortableMetadataKey2(typeId);
try {
BinaryMetadata oldMeta = metaDataCache.localPeek(key);
@@ -483,7 +483,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
if (clientNode)
return clientMetaDataCache.get(typeId);
else {
- BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey(typeId));
+ BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey2(typeId));
return meta != null ? meta.wrap(portableCtx) : null;
}
@@ -497,16 +497,16 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
@Override public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds)
throws BinaryObjectException {
try {
- Collection<PortableMetadataKey> keys = new ArrayList<>(typeIds.size());
+ Collection<PortableMetadataKey2> keys = new ArrayList<>(typeIds.size());
for (Integer typeId : typeIds)
- keys.add(new PortableMetadataKey(typeId));
+ keys.add(new PortableMetadataKey2(typeId));
- Map<PortableMetadataKey, BinaryMetadata> meta = metaDataCache.getAll(keys);
+ Map<PortableMetadataKey2, BinaryMetadata> meta = metaDataCache.getAll(keys);
Map<Integer, BinaryType> res = U.newHashMap(meta.size());
- for (Map.Entry<PortableMetadataKey, BinaryMetadata> e : meta.entrySet())
+ for (Map.Entry<PortableMetadataKey2, BinaryMetadata> e : meta.entrySet())
res.put(e.getKey().typeId(), e.getValue().wrap(portableCtx));
return res;
@@ -527,10 +527,10 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
});
else {
return F.viewReadOnly(metaDataCache.entrySetx(metaPred),
- new C1<Cache.Entry<PortableMetadataKey, BinaryMetadata>, BinaryType>() {
+ new C1<Cache.Entry<PortableMetadataKey2, BinaryMetadata>, BinaryType>() {
private static final long serialVersionUID = 0L;
- @Override public BinaryType apply(Cache.Entry<PortableMetadataKey, BinaryMetadata> e) {
+ @Override public BinaryType apply(Cache.Entry<PortableMetadataKey2, BinaryMetadata> e) {
return e.getValue().wrap(portableCtx);
}
});
@@ -799,7 +799,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/**
*/
private static class MetaDataProcessor implements
- EntryProcessor<PortableMetadataKey, BinaryMetadata, BinaryObjectException>, Externalizable {
+ EntryProcessor<PortableMetadataKey2, BinaryMetadata, BinaryObjectException>, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -829,7 +829,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public BinaryObjectException process(
- MutableEntry<PortableMetadataKey, BinaryMetadata> entry,
+ MutableEntry<PortableMetadataKey2, BinaryMetadata> entry,
Object... args) {
try {
BinaryMetadata oldMeta = entry.getValue();
@@ -873,15 +873,15 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/**
*
*/
- class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey, BinaryMetadata> {
+ class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey2, BinaryMetadata> {
/** {@inheritDoc} */
@Override public void onUpdated(
- Iterable<CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata>> evts)
+ Iterable<CacheEntryEvent<? extends PortableMetadataKey2, ? extends BinaryMetadata>> evts)
throws CacheEntryListenerException {
- for (CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata> evt : evts) {
+ for (CacheEntryEvent<? extends PortableMetadataKey2, ? extends BinaryMetadata> evt : evts) {
assert evt.getEventType() == EventType.CREATED || evt.getEventType() == EventType.UPDATED : evt;
- PortableMetadataKey key = evt.getKey();
+ PortableMetadataKey2 key = evt.getKey();
final BinaryMetadata newMeta = evt.getValue();
@@ -906,7 +906,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public boolean evaluate(CacheEntryEvent<?, ?> evt) throws CacheEntryListenerException {
- return evt.getKey() instanceof PortableMetadataKey;
+ return evt.getKey() instanceof PortableMetadataKey2;
}
/** {@inheritDoc} */
@@ -924,7 +924,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public boolean apply(Object key, Object val) {
- return key instanceof PortableMetadataKey;
+ return key instanceof PortableMetadataKey2;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0efe760/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
deleted file mode 100644
index f838c82..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetaDataKey.java
+++ /dev/null
@@ -1,82 +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.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Key for portable meta data.
- */
-class PortableMetadataKey extends GridCacheUtilityKey<PortableMetadataKey> implements Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private int typeId;
-
- /**
- * For {@link Externalizable}.
- */
- public PortableMetadataKey() {
- // No-op.
- }
-
- /**
- * @param typeId Type ID.
- */
- PortableMetadataKey(int typeId) {
- this.typeId = typeId;
- }
-
- /**
- * @return Type id.
- */
- public int typeId() {
- return typeId;
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(typeId);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- typeId = in.readInt();
- }
-
- /** {@inheritDoc} */
- @Override protected boolean equalsx(PortableMetadataKey key) {
- return typeId == key.typeId;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return typeId;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PortableMetadataKey.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a0efe760/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java
new file mode 100644
index 0000000..4c99b70
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java
@@ -0,0 +1,82 @@
+/*
+ * 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.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Key for portable meta data.
+ */
+class PortableMetadataKey2 extends GridCacheUtilityKey<PortableMetadataKey2> implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private int typeId;
+
+ /**
+ * For {@link Externalizable}.
+ */
+ public PortableMetadataKey2() {
+ // No-op.
+ }
+
+ /**
+ * @param typeId Type ID.
+ */
+ PortableMetadataKey2(int typeId) {
+ this.typeId = typeId;
+ }
+
+ /**
+ * @return Type id.
+ */
+ public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(typeId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ typeId = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean equalsx(PortableMetadataKey2 key) {
+ return typeId == key.typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PortableMetadataKey2.class, this);
+ }
+}
\ No newline at end of file
[39/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
deleted file mode 100644
index 9529503..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
+++ /dev/null
@@ -1,1777 +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.
- */
-
-// ReSharper disable UnassignedField.Global
-// ReSharper disable CollectionNeverUpdated.Global
-namespace Apache.Ignite.Core.Tests.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Impl.Binary;
- using NUnit.Framework;
-
- /// <summary>
- /// Portable builder self test.
- /// </summary>
- public class PortableApiSelfTest
- {
- /** Undefined type: Empty. */
- private const string TypeEmpty = "EmptyUndefined";
-
- /** Grid. */
- private Ignite _grid;
-
- /** Marshaller. */
- private Marshaller _marsh;
-
- /// <summary>
- /// Set up routine.
- /// </summary>
- [TestFixtureSetUp]
- public void SetUp()
- {
- TestUtils.KillProcesses();
-
- var cfg = new IgniteConfiguration
- {
- BinaryConfiguration = new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (Empty)),
- new BinaryTypeConfiguration(typeof (Primitives)),
- new BinaryTypeConfiguration(typeof (PrimitiveArrays)),
- new BinaryTypeConfiguration(typeof (StringDateGuidEnum)),
- new BinaryTypeConfiguration(typeof (WithRaw)),
- new BinaryTypeConfiguration(typeof (MetaOverwrite)),
- new BinaryTypeConfiguration(typeof (NestedOuter)),
- new BinaryTypeConfiguration(typeof (NestedInner)),
- new BinaryTypeConfiguration(typeof (MigrationOuter)),
- new BinaryTypeConfiguration(typeof (MigrationInner)),
- new BinaryTypeConfiguration(typeof (InversionOuter)),
- new BinaryTypeConfiguration(typeof (InversionInner)),
- new BinaryTypeConfiguration(typeof (CompositeOuter)),
- new BinaryTypeConfiguration(typeof (CompositeInner)),
- new BinaryTypeConfiguration(typeof (CompositeArray)),
- new BinaryTypeConfiguration(typeof (CompositeContainer)),
- new BinaryTypeConfiguration(typeof (ToPortable)),
- new BinaryTypeConfiguration(typeof (Remove)),
- new BinaryTypeConfiguration(typeof (RemoveInner)),
- new BinaryTypeConfiguration(typeof (BuilderInBuilderOuter)),
- new BinaryTypeConfiguration(typeof (BuilderInBuilderInner)),
- new BinaryTypeConfiguration(typeof (BuilderCollection)),
- new BinaryTypeConfiguration(typeof (BuilderCollectionItem)),
- new BinaryTypeConfiguration(typeof (DecimalHolder)),
- new BinaryTypeConfiguration(TypeEmpty),
- TypeConfigurationNoMeta(typeof (EmptyNoMeta)),
- TypeConfigurationNoMeta(typeof (ToPortableNoMeta))
- },
- DefaultIdMapper = new IdMapper()
- },
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = new List<string>
- {
- "-ea",
- "-Xcheck:jni",
- "-Xms4g",
- "-Xmx4g",
- "-DIGNITE_QUIET=false",
- "-Xnoagent",
- "-Djava.compiler=NONE",
- "-Xdebug",
- "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005",
- "-XX:+HeapDumpOnOutOfMemoryError"
- },
- SpringConfigUrl = "config\\portable.xml"
- };
-
- _grid = (Ignite) Ignition.Start(cfg);
-
- _marsh = _grid.Marshaller;
- }
-
- /// <summary>
- /// Tear down routine.
- /// </summary>
- [TestFixtureTearDown]
- public virtual void TearDown()
- {
- if (_grid != null)
- Ignition.Stop(_grid.Name, true);
-
- _grid = null;
- }
-
- /// <summary>
- /// Ensure that portable engine is able to work with type names, which are not configured.
- /// </summary>
- [Test]
- public void TestNonConfigured()
- {
- string typeName1 = "Type1";
- string typeName2 = "Type2";
- string field1 = "field1";
- string field2 = "field2";
-
- // 1. Ensure that builder works fine.
- IBinaryObject portObj1 = _grid.GetBinary().GetBuilder(typeName1).SetField(field1, 1).Build();
-
- Assert.AreEqual(typeName1, portObj1.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj1.GetBinaryType().Fields.Count);
- Assert.AreEqual(field1, portObj1.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, portObj1.GetBinaryType().GetFieldTypeName(field1));
-
- Assert.AreEqual(1, portObj1.GetField<int>(field1));
-
- // 2. Ensure that object can be unmarshalled without deserialization.
- byte[] data = ((BinaryObject) portObj1).Data;
-
- portObj1 = _grid.Marshaller.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
-
- Assert.AreEqual(typeName1, portObj1.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj1.GetBinaryType().Fields.Count);
- Assert.AreEqual(field1, portObj1.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, portObj1.GetBinaryType().GetFieldTypeName(field1));
-
- Assert.AreEqual(1, portObj1.GetField<int>(field1));
-
- // 3. Ensure that we can nest one anonymous object inside another
- IBinaryObject portObj2 =
- _grid.GetBinary().GetBuilder(typeName2).SetField(field2, portObj1).Build();
-
- Assert.AreEqual(typeName2, portObj2.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj2.GetBinaryType().Fields.Count);
- Assert.AreEqual(field2, portObj2.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, portObj2.GetBinaryType().GetFieldTypeName(field2));
-
- portObj1 = portObj2.GetField<IBinaryObject>(field2);
-
- Assert.AreEqual(typeName1, portObj1.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj1.GetBinaryType().Fields.Count);
- Assert.AreEqual(field1, portObj1.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, portObj1.GetBinaryType().GetFieldTypeName(field1));
-
- Assert.AreEqual(1, portObj1.GetField<int>(field1));
-
- // 4. Ensure that we can unmarshal object with other nested object.
- data = ((BinaryObject) portObj2).Data;
-
- portObj2 = _grid.Marshaller.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
-
- Assert.AreEqual(typeName2, portObj2.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj2.GetBinaryType().Fields.Count);
- Assert.AreEqual(field2, portObj2.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, portObj2.GetBinaryType().GetFieldTypeName(field2));
-
- portObj1 = portObj2.GetField<IBinaryObject>(field2);
-
- Assert.AreEqual(typeName1, portObj1.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj1.GetBinaryType().Fields.Count);
- Assert.AreEqual(field1, portObj1.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, portObj1.GetBinaryType().GetFieldTypeName(field1));
-
- Assert.AreEqual(1, portObj1.GetField<int>(field1));
- }
-
- /// <summary>
- /// Test "ToPortable()" method.
- /// </summary>
- [Test]
- public void TestToPortable()
- {
- DateTime date = DateTime.Now.ToUniversalTime();
- Guid guid = Guid.NewGuid();
-
- IIgniteBinary api = _grid.GetBinary();
-
- // 1. Primitives.
- Assert.AreEqual(1, api.ToBinary<byte>((byte)1));
- Assert.AreEqual(1, api.ToBinary<short>((short)1));
- Assert.AreEqual(1, api.ToBinary<int>(1));
- Assert.AreEqual(1, api.ToBinary<long>((long)1));
-
- Assert.AreEqual((float)1, api.ToBinary<float>((float)1));
- Assert.AreEqual((double)1, api.ToBinary<double>((double)1));
-
- Assert.AreEqual(true, api.ToBinary<bool>(true));
- Assert.AreEqual('a', api.ToBinary<char>('a'));
-
- // 2. Special types.
- Assert.AreEqual("a", api.ToBinary<string>("a"));
- Assert.AreEqual(date, api.ToBinary<DateTime>(date));
- Assert.AreEqual(guid, api.ToBinary<Guid>(guid));
- Assert.AreEqual(TestEnum.One, api.ToBinary<TestEnum>(TestEnum.One));
-
- // 3. Arrays.
- Assert.AreEqual(new byte[] { 1 }, api.ToBinary<byte[]>(new byte[] { 1 }));
- Assert.AreEqual(new short[] { 1 }, api.ToBinary<short[]>(new short[] { 1 }));
- Assert.AreEqual(new[] { 1 }, api.ToBinary<int[]>(new[] { 1 }));
- Assert.AreEqual(new long[] { 1 }, api.ToBinary<long[]>(new long[] { 1 }));
-
- Assert.AreEqual(new float[] { 1 }, api.ToBinary<float[]>(new float[] { 1 }));
- Assert.AreEqual(new double[] { 1 }, api.ToBinary<double[]>(new double[] { 1 }));
-
- Assert.AreEqual(new[] { true }, api.ToBinary<bool[]>(new[] { true }));
- Assert.AreEqual(new[] { 'a' }, api.ToBinary<char[]>(new[] { 'a' }));
-
- Assert.AreEqual(new[] { "a" }, api.ToBinary<string[]>(new[] { "a" }));
- Assert.AreEqual(new[] { date }, api.ToBinary<DateTime[]>(new[] { date }));
- Assert.AreEqual(new[] { guid }, api.ToBinary<Guid[]>(new[] { guid }));
- Assert.AreEqual(new[] { TestEnum.One }, api.ToBinary<TestEnum[]>(new[] { TestEnum.One }));
-
- // 4. Objects.
- IBinaryObject portObj = api.ToBinary<IBinaryObject>(new ToPortable(1));
-
- Assert.AreEqual(typeof(ToPortable).Name, portObj.GetBinaryType().TypeName);
- Assert.AreEqual(1, portObj.GetBinaryType().Fields.Count);
- Assert.AreEqual("Val", portObj.GetBinaryType().Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, portObj.GetBinaryType().GetFieldTypeName("Val"));
-
- Assert.AreEqual(1, portObj.GetField<int>("val"));
- Assert.AreEqual(1, portObj.Deserialize<ToPortable>().Val);
-
- portObj = api.ToBinary<IBinaryObject>(new ToPortableNoMeta(1));
-
- Assert.AreEqual(1, portObj.GetBinaryType().Fields.Count);
-
- Assert.AreEqual(1, portObj.GetField<int>("Val"));
- Assert.AreEqual(1, portObj.Deserialize<ToPortableNoMeta>().Val);
-
- // 5. Object array.
- var portObjArr = api.ToBinary<object[]>(new object[] {new ToPortable(1)})
- .OfType<IBinaryObject>().ToArray();
-
- Assert.AreEqual(1, portObjArr.Length);
- Assert.AreEqual(1, portObjArr[0].GetField<int>("Val"));
- Assert.AreEqual(1, portObjArr[0].Deserialize<ToPortable>().Val);
- }
-
- /// <summary>
- /// Test builder field remove logic.
- /// </summary>
- [Test]
- public void TestRemove()
- {
- // Create empty object.
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(Remove)).Build();
-
- Assert.IsNull(portObj.GetField<object>("val"));
- Assert.IsNull(portObj.Deserialize<Remove>().Val);
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(Remove).Name, meta.TypeName);
- Assert.AreEqual(0, meta.Fields.Count);
-
- // Populate it with field.
- IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(portObj);
-
- Assert.IsNull(builder.GetField<object>("val"));
-
- object val = 1;
-
- builder.SetField("val", val);
-
- Assert.AreEqual(val, builder.GetField<object>("val"));
-
- portObj = builder.Build();
-
- Assert.AreEqual(val, portObj.GetField<object>("val"));
- Assert.AreEqual(val, portObj.Deserialize<Remove>().Val);
-
- meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(Remove).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual("val", meta.Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("val"));
-
- // Perform field remove.
- builder = _grid.GetBinary().GetBuilder(portObj);
-
- Assert.AreEqual(val, builder.GetField<object>("val"));
-
- builder.RemoveField("val");
- Assert.IsNull(builder.GetField<object>("val"));
-
- builder.SetField("val", val);
- Assert.AreEqual(val, builder.GetField<object>("val"));
-
- builder.RemoveField("val");
- Assert.IsNull(builder.GetField<object>("val"));
-
- portObj = builder.Build();
-
- Assert.IsNull(portObj.GetField<object>("val"));
- Assert.IsNull(portObj.Deserialize<Remove>().Val);
-
- // Test correct removal of field being referenced by handle somewhere else.
- RemoveInner inner = new RemoveInner(2);
-
- portObj = _grid.GetBinary().GetBuilder(typeof(Remove))
- .SetField("val", inner)
- .SetField("val2", inner)
- .Build();
-
- portObj = _grid.GetBinary().GetBuilder(portObj).RemoveField("val").Build();
-
- Remove obj = portObj.Deserialize<Remove>();
-
- Assert.IsNull(obj.Val);
- Assert.AreEqual(2, obj.Val2.Val);
- }
-
- /// <summary>
- /// Test builder-in-builder scenario.
- /// </summary>
- [Test]
- public void TestBuilderInBuilder()
- {
- // Test different builders assembly.
- IBinaryObjectBuilder builderOuter = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderOuter));
- IBinaryObjectBuilder builderInner = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderInner));
-
- builderOuter.SetField<object>("inner", builderInner);
- builderInner.SetField<object>("outer", builderOuter);
-
- IBinaryObject outerPortObj = builderOuter.Build();
-
- IBinaryType meta = outerPortObj.GetBinaryType();
-
- Assert.AreEqual(typeof(BuilderInBuilderOuter).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual("inner", meta.Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner"));
-
- IBinaryObject innerPortObj = outerPortObj.GetField<IBinaryObject>("inner");
-
- meta = innerPortObj.GetBinaryType();
-
- Assert.AreEqual(typeof(BuilderInBuilderInner).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual("outer", meta.Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("outer"));
-
- BuilderInBuilderOuter outer = outerPortObj.Deserialize<BuilderInBuilderOuter>();
-
- Assert.AreSame(outer, outer.Inner.Outer);
-
- // Test same builders assembly.
- innerPortObj = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderInner)).Build();
-
- outerPortObj = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderOuter))
- .SetField("inner", innerPortObj)
- .SetField("inner2", innerPortObj)
- .Build();
-
- meta = outerPortObj.GetBinaryType();
-
- Assert.AreEqual(typeof(BuilderInBuilderOuter).Name, meta.TypeName);
- Assert.AreEqual(2, meta.Fields.Count);
- Assert.IsTrue(meta.Fields.Contains("inner"));
- Assert.IsTrue(meta.Fields.Contains("inner2"));
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner"));
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner2"));
-
- outer = outerPortObj.Deserialize<BuilderInBuilderOuter>();
-
- Assert.AreSame(outer.Inner, outer.Inner2);
-
- builderOuter = _grid.GetBinary().GetBuilder(outerPortObj);
- IBinaryObjectBuilder builderInner2 = builderOuter.GetField<IBinaryObjectBuilder>("inner2");
-
- builderInner2.SetField("outer", builderOuter);
-
- outerPortObj = builderOuter.Build();
-
- outer = outerPortObj.Deserialize<BuilderInBuilderOuter>();
-
- Assert.AreSame(outer, outer.Inner.Outer);
- Assert.AreSame(outer.Inner, outer.Inner2);
- }
-
- /// <summary>
- /// Test for decimals building.
- /// </summary>
- [Test]
- public void TestDecimals()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(DecimalHolder))
- .SetField("val", decimal.One)
- .SetField("valArr", new decimal?[] { decimal.MinusOne })
- .Build();
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(DecimalHolder).Name, meta.TypeName);
- Assert.AreEqual(2, meta.Fields.Count);
- Assert.IsTrue(meta.Fields.Contains("val"));
- Assert.IsTrue(meta.Fields.Contains("valArr"));
- Assert.AreEqual(BinaryTypeNames.TypeNameDecimal, meta.GetFieldTypeName("val"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayDecimal, meta.GetFieldTypeName("valArr"));
-
- Assert.AreEqual(decimal.One, portObj.GetField<decimal>("val"));
- Assert.AreEqual(new decimal?[] { decimal.MinusOne }, portObj.GetField<decimal?[]>("valArr"));
-
- DecimalHolder obj = portObj.Deserialize<DecimalHolder>();
-
- Assert.AreEqual(decimal.One, obj.Val);
- Assert.AreEqual(new decimal?[] { decimal.MinusOne }, obj.ValArr);
- }
-
- /// <summary>
- /// Test for an object returning collection of builders.
- /// </summary>
- [Test]
- public void TestBuilderCollection()
- {
- // Test collection with single element.
- IBinaryObjectBuilder builderCol = _grid.GetBinary().GetBuilder(typeof(BuilderCollection));
- IBinaryObjectBuilder builderItem =
- _grid.GetBinary().GetBuilder(typeof(BuilderCollectionItem)).SetField("val", 1);
-
- builderCol.SetCollectionField("col", new ArrayList { builderItem });
-
- IBinaryObject portCol = builderCol.Build();
-
- IBinaryType meta = portCol.GetBinaryType();
-
- Assert.AreEqual(typeof(BuilderCollection).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual("col", meta.Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameCollection, meta.GetFieldTypeName("col"));
-
- var portColItems = portCol.GetField<ArrayList>("col");
-
- Assert.AreEqual(1, portColItems.Count);
-
- var portItem = (IBinaryObject) portColItems[0];
-
- meta = portItem.GetBinaryType();
-
- Assert.AreEqual(typeof(BuilderCollectionItem).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual("val", meta.Fields.First());
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, meta.GetFieldTypeName("val"));
-
- BuilderCollection col = portCol.Deserialize<BuilderCollection>();
-
- Assert.IsNotNull(col.Col);
- Assert.AreEqual(1, col.Col.Count);
- Assert.AreEqual(1, ((BuilderCollectionItem) col.Col[0]).Val);
-
- // Add more portable objects to collection.
- builderCol = _grid.GetBinary().GetBuilder(portCol);
-
- IList builderColItems = builderCol.GetField<IList>("col");
-
- Assert.AreEqual(1, builderColItems.Count);
-
- BinaryObjectBuilder builderColItem = (BinaryObjectBuilder) builderColItems[0];
-
- builderColItem.SetField("val", 2); // Change nested value.
-
- builderColItems.Add(builderColItem); // Add the same object to check handles.
- builderColItems.Add(builderItem); // Add item from another builder.
- builderColItems.Add(portItem); // Add item in portable form.
-
- portCol = builderCol.Build();
-
- col = portCol.Deserialize<BuilderCollection>();
-
- Assert.AreEqual(4, col.Col.Count);
-
- var item0 = (BuilderCollectionItem) col.Col[0];
- var item1 = (BuilderCollectionItem) col.Col[1];
- var item2 = (BuilderCollectionItem) col.Col[2];
- var item3 = (BuilderCollectionItem) col.Col[3];
-
- Assert.AreEqual(2, item0.Val);
-
- Assert.AreSame(item0, item1);
- Assert.AreNotSame(item0, item2);
- Assert.AreNotSame(item0, item3);
-
- Assert.AreEqual(1, item2.Val);
- Assert.AreEqual(1, item3.Val);
-
- Assert.AreNotSame(item2, item3);
-
- // Test handle update inside collection.
- builderCol = _grid.GetBinary().GetBuilder(portCol);
-
- builderColItems = builderCol.GetField<IList>("col");
-
- ((BinaryObjectBuilder) builderColItems[1]).SetField("val", 3);
-
- portCol = builderCol.Build();
-
- col = portCol.Deserialize<BuilderCollection>();
-
- item0 = (BuilderCollectionItem) col.Col[0];
- item1 = (BuilderCollectionItem) col.Col[1];
-
- Assert.AreEqual(3, item0.Val);
- Assert.AreSame(item0, item1);
- }
-
- /// <summary>
- /// Test build of an empty object.
- /// </summary>
- [Test]
- public void TestEmptyDefined()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(Empty)).Build();
-
- Assert.IsNotNull(portObj);
- Assert.AreEqual(0, portObj.GetHashCode());
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.IsNotNull(meta);
- Assert.AreEqual(typeof(Empty).Name, meta.TypeName);
- Assert.AreEqual(0, meta.Fields.Count);
-
- Empty obj = portObj.Deserialize<Empty>();
-
- Assert.IsNotNull(obj);
- }
-
- /// <summary>
- /// Test build of an empty object with disabled metadata.
- /// </summary>
- [Test]
- public void TestEmptyNoMeta()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(EmptyNoMeta)).Build();
-
- Assert.IsNotNull(portObj);
- Assert.AreEqual(0, portObj.GetHashCode());
-
- EmptyNoMeta obj = portObj.Deserialize<EmptyNoMeta>();
-
- Assert.IsNotNull(obj);
- }
-
- /// <summary>
- /// Test build of an empty undefined object.
- /// </summary>
- [Test]
- public void TestEmptyUndefined()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(TypeEmpty).Build();
-
- Assert.IsNotNull(portObj);
- Assert.AreEqual(0, portObj.GetHashCode());
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.IsNotNull(meta);
- Assert.AreEqual(TypeEmpty, meta.TypeName);
- Assert.AreEqual(0, meta.Fields.Count);
- }
-
- /// <summary>
- /// Test object rebuild with no changes.
- /// </summary>
- [Test]
- public void TestEmptyRebuild()
- {
- var portObj = (BinaryObject) _grid.GetBinary().GetBuilder(typeof(EmptyNoMeta)).Build();
-
- BinaryObject newPortObj = (BinaryObject) _grid.GetBinary().GetBuilder(portObj).Build();
-
- Assert.AreEqual(portObj.Data, newPortObj.Data);
- }
-
- /// <summary>
- /// Test hash code alteration.
- /// </summary>
- [Test]
- public void TestHashCodeChange()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(EmptyNoMeta)).SetHashCode(100).Build();
-
- Assert.AreEqual(100, portObj.GetHashCode());
- }
-
- /// <summary>
- /// Test primitive fields setting.
- /// </summary>
- [Test]
- public void TestPrimitiveFields()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(Primitives))
- .SetField<byte>("fByte", 1)
- .SetField("fBool", true)
- .SetField<short>("fShort", 2)
- .SetField("fChar", 'a')
- .SetField("fInt", 3)
- .SetField<long>("fLong", 4)
- .SetField<float>("fFloat", 5)
- .SetField<double>("fDouble", 6)
- .SetHashCode(100)
- .Build();
-
- Assert.AreEqual(100, portObj.GetHashCode());
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(Primitives).Name, meta.TypeName);
-
- Assert.AreEqual(8, meta.Fields.Count);
-
- Assert.AreEqual(BinaryTypeNames.TypeNameByte, meta.GetFieldTypeName("fByte"));
- Assert.AreEqual(BinaryTypeNames.TypeNameBool, meta.GetFieldTypeName("fBool"));
- Assert.AreEqual(BinaryTypeNames.TypeNameShort, meta.GetFieldTypeName("fShort"));
- Assert.AreEqual(BinaryTypeNames.TypeNameChar, meta.GetFieldTypeName("fChar"));
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, meta.GetFieldTypeName("fInt"));
- Assert.AreEqual(BinaryTypeNames.TypeNameLong, meta.GetFieldTypeName("fLong"));
- Assert.AreEqual(BinaryTypeNames.TypeNameFloat, meta.GetFieldTypeName("fFloat"));
- Assert.AreEqual(BinaryTypeNames.TypeNameDouble, meta.GetFieldTypeName("fDouble"));
-
- Assert.AreEqual(1, portObj.GetField<byte>("fByte"));
- Assert.AreEqual(true, portObj.GetField<bool>("fBool"));
- Assert.AreEqual(2, portObj.GetField<short>("fShort"));
- Assert.AreEqual('a', portObj.GetField<char>("fChar"));
- Assert.AreEqual(3, portObj.GetField<int>("fInt"));
- Assert.AreEqual(4, portObj.GetField<long>("fLong"));
- Assert.AreEqual(5, portObj.GetField<float>("fFloat"));
- Assert.AreEqual(6, portObj.GetField<double>("fDouble"));
-
- Primitives obj = portObj.Deserialize<Primitives>();
-
- Assert.AreEqual(1, obj.FByte);
- Assert.AreEqual(true, obj.FBool);
- Assert.AreEqual(2, obj.FShort);
- Assert.AreEqual('a', obj.FChar);
- Assert.AreEqual(3, obj.FInt);
- Assert.AreEqual(4, obj.FLong);
- Assert.AreEqual(5, obj.FFloat);
- Assert.AreEqual(6, obj.FDouble);
-
- // Overwrite.
- portObj = _grid.GetBinary().GetBuilder(portObj)
- .SetField<byte>("fByte", 7)
- .SetField("fBool", false)
- .SetField<short>("fShort", 8)
- .SetField("fChar", 'b')
- .SetField("fInt", 9)
- .SetField<long>("fLong", 10)
- .SetField<float>("fFloat", 11)
- .SetField<double>("fDouble", 12)
- .SetHashCode(200)
- .Build();
-
- Assert.AreEqual(200, portObj.GetHashCode());
-
- Assert.AreEqual(7, portObj.GetField<byte>("fByte"));
- Assert.AreEqual(false, portObj.GetField<bool>("fBool"));
- Assert.AreEqual(8, portObj.GetField<short>("fShort"));
- Assert.AreEqual('b', portObj.GetField<char>("fChar"));
- Assert.AreEqual(9, portObj.GetField<int>("fInt"));
- Assert.AreEqual(10, portObj.GetField<long>("fLong"));
- Assert.AreEqual(11, portObj.GetField<float>("fFloat"));
- Assert.AreEqual(12, portObj.GetField<double>("fDouble"));
-
- obj = portObj.Deserialize<Primitives>();
-
- Assert.AreEqual(7, obj.FByte);
- Assert.AreEqual(false, obj.FBool);
- Assert.AreEqual(8, obj.FShort);
- Assert.AreEqual('b', obj.FChar);
- Assert.AreEqual(9, obj.FInt);
- Assert.AreEqual(10, obj.FLong);
- Assert.AreEqual(11, obj.FFloat);
- Assert.AreEqual(12, obj.FDouble);
- }
-
- /// <summary>
- /// Test primitive array fields setting.
- /// </summary>
- [Test]
- public void TestPrimitiveArrayFields()
- {
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(PrimitiveArrays))
- .SetField("fByte", new byte[] { 1 })
- .SetField("fBool", new[] { true })
- .SetField("fShort", new short[] { 2 })
- .SetField("fChar", new[] { 'a' })
- .SetField("fInt", new[] { 3 })
- .SetField("fLong", new long[] { 4 })
- .SetField("fFloat", new float[] { 5 })
- .SetField("fDouble", new double[] { 6 })
- .SetHashCode(100)
- .Build();
-
- Assert.AreEqual(100, portObj.GetHashCode());
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(PrimitiveArrays).Name, meta.TypeName);
-
- Assert.AreEqual(8, meta.Fields.Count);
-
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayByte, meta.GetFieldTypeName("fByte"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayBool, meta.GetFieldTypeName("fBool"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayShort, meta.GetFieldTypeName("fShort"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayChar, meta.GetFieldTypeName("fChar"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayInt, meta.GetFieldTypeName("fInt"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayLong, meta.GetFieldTypeName("fLong"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayFloat, meta.GetFieldTypeName("fFloat"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayDouble, meta.GetFieldTypeName("fDouble"));
-
- Assert.AreEqual(new byte[] { 1 }, portObj.GetField<byte[]>("fByte"));
- Assert.AreEqual(new[] { true }, portObj.GetField<bool[]>("fBool"));
- Assert.AreEqual(new short[] { 2 }, portObj.GetField<short[]>("fShort"));
- Assert.AreEqual(new[] { 'a' }, portObj.GetField<char[]>("fChar"));
- Assert.AreEqual(new[] { 3 }, portObj.GetField<int[]>("fInt"));
- Assert.AreEqual(new long[] { 4 }, portObj.GetField<long[]>("fLong"));
- Assert.AreEqual(new float[] { 5 }, portObj.GetField<float[]>("fFloat"));
- Assert.AreEqual(new double[] { 6 }, portObj.GetField<double[]>("fDouble"));
-
- PrimitiveArrays obj = portObj.Deserialize<PrimitiveArrays>();
-
- Assert.AreEqual(new byte[] { 1 }, obj.FByte);
- Assert.AreEqual(new[] { true }, obj.FBool);
- Assert.AreEqual(new short[] { 2 }, obj.FShort);
- Assert.AreEqual(new[] { 'a' }, obj.FChar);
- Assert.AreEqual(new[] { 3 }, obj.FInt);
- Assert.AreEqual(new long[] { 4 }, obj.FLong);
- Assert.AreEqual(new float[] { 5 }, obj.FFloat);
- Assert.AreEqual(new double[] { 6 }, obj.FDouble);
-
- // Overwrite.
- portObj = _grid.GetBinary().GetBuilder(portObj)
- .SetField("fByte", new byte[] { 7 })
- .SetField("fBool", new[] { false })
- .SetField("fShort", new short[] { 8 })
- .SetField("fChar", new[] { 'b' })
- .SetField("fInt", new[] { 9 })
- .SetField("fLong", new long[] { 10 })
- .SetField("fFloat", new float[] { 11 })
- .SetField("fDouble", new double[] { 12 })
- .SetHashCode(200)
- .Build();
-
- Assert.AreEqual(200, portObj.GetHashCode());
-
- Assert.AreEqual(new byte[] { 7 }, portObj.GetField<byte[]>("fByte"));
- Assert.AreEqual(new[] { false }, portObj.GetField<bool[]>("fBool"));
- Assert.AreEqual(new short[] { 8 }, portObj.GetField<short[]>("fShort"));
- Assert.AreEqual(new[] { 'b' }, portObj.GetField<char[]>("fChar"));
- Assert.AreEqual(new[] { 9 }, portObj.GetField<int[]>("fInt"));
- Assert.AreEqual(new long[] { 10 }, portObj.GetField<long[]>("fLong"));
- Assert.AreEqual(new float[] { 11 }, portObj.GetField<float[]>("fFloat"));
- Assert.AreEqual(new double[] { 12 }, portObj.GetField<double[]>("fDouble"));
-
- obj = portObj.Deserialize<PrimitiveArrays>();
-
- Assert.AreEqual(new byte[] { 7 }, obj.FByte);
- Assert.AreEqual(new[] { false }, obj.FBool);
- Assert.AreEqual(new short[] { 8 }, obj.FShort);
- Assert.AreEqual(new[] { 'b' }, obj.FChar);
- Assert.AreEqual(new[] { 9 }, obj.FInt);
- Assert.AreEqual(new long[] { 10 }, obj.FLong);
- Assert.AreEqual(new float[] { 11 }, obj.FFloat);
- Assert.AreEqual(new double[] { 12 }, obj.FDouble);
- }
-
- /// <summary>
- /// Test non-primitive fields and their array counterparts.
- /// </summary>
- [Test]
- public void TestStringDateGuidEnum()
- {
- DateTime? nDate = DateTime.Now;
-
- Guid? nGuid = Guid.NewGuid();
-
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(StringDateGuidEnum))
- .SetField("fStr", "str")
- .SetField("fNDate", nDate)
- .SetGuidField("fNGuid", nGuid)
- .SetField("fEnum", TestEnum.One)
- .SetField("fStrArr", new[] { "str" })
- .SetArrayField("fDateArr", new[] { nDate })
- .SetGuidArrayField("fGuidArr", new[] { nGuid })
- .SetField("fEnumArr", new[] { TestEnum.One })
- .SetHashCode(100)
- .Build();
-
- Assert.AreEqual(100, portObj.GetHashCode());
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(StringDateGuidEnum).Name, meta.TypeName);
-
- Assert.AreEqual(8, meta.Fields.Count);
-
- Assert.AreEqual(BinaryTypeNames.TypeNameString, meta.GetFieldTypeName("fStr"));
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("fNDate"));
- Assert.AreEqual(BinaryTypeNames.TypeNameGuid, meta.GetFieldTypeName("fNGuid"));
- Assert.AreEqual(BinaryTypeNames.TypeNameEnum, meta.GetFieldTypeName("fEnum"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayString, meta.GetFieldTypeName("fStrArr"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("fDateArr"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayGuid, meta.GetFieldTypeName("fGuidArr"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayEnum, meta.GetFieldTypeName("fEnumArr"));
-
- Assert.AreEqual("str", portObj.GetField<string>("fStr"));
- Assert.AreEqual(nDate, portObj.GetField<DateTime?>("fNDate"));
- Assert.AreEqual(nGuid, portObj.GetField<Guid?>("fNGuid"));
- Assert.AreEqual(TestEnum.One, portObj.GetField<TestEnum>("fEnum"));
- Assert.AreEqual(new[] { "str" }, portObj.GetField<string[]>("fStrArr"));
- Assert.AreEqual(new[] { nDate }, portObj.GetField<DateTime?[]>("fDateArr"));
- Assert.AreEqual(new[] { nGuid }, portObj.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.One }, portObj.GetField<TestEnum[]>("fEnumArr"));
-
- StringDateGuidEnum obj = portObj.Deserialize<StringDateGuidEnum>();
-
- Assert.AreEqual("str", obj.FStr);
- Assert.AreEqual(nDate, obj.FnDate);
- Assert.AreEqual(nGuid, obj.FnGuid);
- Assert.AreEqual(TestEnum.One, obj.FEnum);
- Assert.AreEqual(new[] { "str" }, obj.FStrArr);
- Assert.AreEqual(new[] { nDate }, obj.FDateArr);
- Assert.AreEqual(new[] { nGuid }, obj.FGuidArr);
- Assert.AreEqual(new[] { TestEnum.One }, obj.FEnumArr);
-
- // Check builder field caching.
- var builder = _grid.GetBinary().GetBuilder(portObj);
-
- Assert.AreEqual("str", builder.GetField<string>("fStr"));
- Assert.AreEqual(nDate, builder.GetField<DateTime?>("fNDate"));
- Assert.AreEqual(nGuid, builder.GetField<Guid?>("fNGuid"));
- Assert.AreEqual(TestEnum.One, builder.GetField<TestEnum>("fEnum"));
- Assert.AreEqual(new[] { "str" }, builder.GetField<string[]>("fStrArr"));
- Assert.AreEqual(new[] { nDate }, builder.GetField<DateTime?[]>("fDateArr"));
- Assert.AreEqual(new[] { nGuid }, builder.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.One }, builder.GetField<TestEnum[]>("fEnumArr"));
-
- // Check reassemble.
- portObj = builder.Build();
-
- Assert.AreEqual("str", portObj.GetField<string>("fStr"));
- Assert.AreEqual(nDate, portObj.GetField<DateTime?>("fNDate"));
- Assert.AreEqual(nGuid, portObj.GetField<Guid?>("fNGuid"));
- Assert.AreEqual(TestEnum.One, portObj.GetField<TestEnum>("fEnum"));
- Assert.AreEqual(new[] { "str" }, portObj.GetField<string[]>("fStrArr"));
- Assert.AreEqual(new[] { nDate }, portObj.GetField<DateTime?[]>("fDateArr"));
- Assert.AreEqual(new[] { nGuid }, portObj.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.One }, portObj.GetField<TestEnum[]>("fEnumArr"));
-
- obj = portObj.Deserialize<StringDateGuidEnum>();
-
- Assert.AreEqual("str", obj.FStr);
- Assert.AreEqual(nDate, obj.FnDate);
- Assert.AreEqual(nGuid, obj.FnGuid);
- Assert.AreEqual(TestEnum.One, obj.FEnum);
- Assert.AreEqual(new[] { "str" }, obj.FStrArr);
- Assert.AreEqual(new[] { nDate }, obj.FDateArr);
- Assert.AreEqual(new[] { nGuid }, obj.FGuidArr);
- Assert.AreEqual(new[] { TestEnum.One }, obj.FEnumArr);
-
- // Overwrite.
- nDate = DateTime.Now.ToUniversalTime();
- nGuid = Guid.NewGuid();
-
- portObj = builder
- .SetField("fStr", "str2")
- .SetTimestampField("fNDate", nDate)
- .SetField("fNGuid", nGuid)
- .SetField("fEnum", TestEnum.Two)
- .SetField("fStrArr", new[] { "str2" })
- .SetArrayField("fDateArr", new[] { nDate })
- .SetField("fGuidArr", new[] { nGuid })
- .SetField("fEnumArr", new[] { TestEnum.Two })
- .SetHashCode(200)
- .Build();
-
- Assert.AreEqual(200, portObj.GetHashCode());
-
- Assert.AreEqual("str2", portObj.GetField<string>("fStr"));
- Assert.AreEqual(nDate, portObj.GetField<DateTime?>("fNDate"));
- Assert.AreEqual(nGuid, portObj.GetField<Guid?>("fNGuid"));
- Assert.AreEqual(TestEnum.Two, portObj.GetField<TestEnum>("fEnum"));
- Assert.AreEqual(new[] { "str2" }, portObj.GetField<string[]>("fStrArr"));
- Assert.AreEqual(new[] { nDate }, portObj.GetField<DateTime?[]>("fDateArr"));
- Assert.AreEqual(new[] { nGuid }, portObj.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.Two }, portObj.GetField<TestEnum[]>("fEnumArr"));
-
- obj = portObj.Deserialize<StringDateGuidEnum>();
-
- Assert.AreEqual("str2", obj.FStr);
- Assert.AreEqual(nDate, obj.FnDate);
- Assert.AreEqual(nGuid, obj.FnGuid);
- Assert.AreEqual(TestEnum.Two, obj.FEnum);
- Assert.AreEqual(new[] { "str2" }, obj.FStrArr);
- Assert.AreEqual(new[] { nDate }, obj.FDateArr);
- Assert.AreEqual(new[] { nGuid }, obj.FGuidArr);
- Assert.AreEqual(new[] { TestEnum.Two }, obj.FEnumArr);
- }
-
- /// <summary>
- /// Test arrays.
- /// </summary>
- [Test]
- public void TestCompositeArray()
- {
- // 1. Test simple array.
- object[] inArr = { new CompositeInner(1) };
-
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
- .SetField("inArr", inArr).Build();
-
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(CompositeArray).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
-
- Assert.AreEqual(100, portObj.GetHashCode());
-
- IBinaryObject[] portInArr = portObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(1, portInArr.Length);
- Assert.AreEqual(1, portInArr[0].GetField<int>("val"));
-
- CompositeArray arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.OutArr);
- Assert.AreEqual(1, arr.InArr.Length);
- Assert.AreEqual(1, ((CompositeInner) arr.InArr[0]).Val);
-
- // 2. Test addition to array.
- portObj = _grid.GetBinary().GetBuilder(portObj).SetHashCode(200)
- .SetField("inArr", new object[] { portInArr[0], null }).Build();
-
- Assert.AreEqual(200, portObj.GetHashCode());
-
- portInArr = portObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(2, portInArr.Length);
- Assert.AreEqual(1, portInArr[0].GetField<int>("val"));
- Assert.IsNull(portInArr[1]);
-
- arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.OutArr);
- Assert.AreEqual(2, arr.InArr.Length);
- Assert.AreEqual(1, ((CompositeInner) arr.InArr[0]).Val);
- Assert.IsNull(arr.InArr[1]);
-
- portInArr[1] = _grid.GetBinary().GetBuilder(typeof(CompositeInner)).SetField("val", 2).Build();
-
- portObj = _grid.GetBinary().GetBuilder(portObj).SetHashCode(300)
- .SetField("inArr", portInArr.OfType<object>().ToArray()).Build();
-
- Assert.AreEqual(300, portObj.GetHashCode());
-
- portInArr = portObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(2, portInArr.Length);
- Assert.AreEqual(1, portInArr[0].GetField<int>("val"));
- Assert.AreEqual(2, portInArr[1].GetField<int>("val"));
-
- arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.OutArr);
- Assert.AreEqual(2, arr.InArr.Length);
- Assert.AreEqual(1, ((CompositeInner)arr.InArr[0]).Val);
- Assert.AreEqual(2, ((CompositeInner)arr.InArr[1]).Val);
-
- // 3. Test top-level handle inversion.
- CompositeInner inner = new CompositeInner(1);
-
- inArr = new object[] { inner, inner };
-
- portObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
- .SetField("inArr", inArr).Build();
-
- Assert.AreEqual(100, portObj.GetHashCode());
-
- portInArr = portObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(2, portInArr.Length);
- Assert.AreEqual(1, portInArr[0].GetField<int>("val"));
- Assert.AreEqual(1, portInArr[1].GetField<int>("val"));
-
- arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.OutArr);
- Assert.AreEqual(2, arr.InArr.Length);
- Assert.AreEqual(1, ((CompositeInner)arr.InArr[0]).Val);
- Assert.AreEqual(1, ((CompositeInner)arr.InArr[1]).Val);
-
- portInArr[0] = _grid.GetBinary().GetBuilder(typeof(CompositeInner)).SetField("val", 2).Build();
-
- portObj = _grid.GetBinary().GetBuilder(portObj).SetHashCode(200)
- .SetField("inArr", portInArr.ToArray<object>()).Build();
-
- Assert.AreEqual(200, portObj.GetHashCode());
-
- portInArr = portObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(2, portInArr.Length);
- Assert.AreEqual(2, portInArr[0].GetField<int>("val"));
- Assert.AreEqual(1, portInArr[1].GetField<int>("val"));
-
- arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.OutArr);
- Assert.AreEqual(2, arr.InArr.Length);
- Assert.AreEqual(2, ((CompositeInner)arr.InArr[0]).Val);
- Assert.AreEqual(1, ((CompositeInner)arr.InArr[1]).Val);
-
- // 4. Test nested object handle inversion.
- CompositeOuter[] outArr = { new CompositeOuter(inner), new CompositeOuter(inner) };
-
- portObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
- .SetField("outArr", outArr.ToArray<object>()).Build();
-
- meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(CompositeArray).Name, meta.TypeName);
- Assert.AreEqual(2, meta.Fields.Count);
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
- Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("outArr"));
-
- Assert.AreEqual(100, portObj.GetHashCode());
-
- var portOutArr = portObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(2, portOutArr.Length);
- Assert.AreEqual(1, portOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
- Assert.AreEqual(1, portOutArr[1].GetField<IBinaryObject>("inner").GetField<int>("val"));
-
- arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.InArr);
- Assert.AreEqual(2, arr.OutArr.Length);
- Assert.AreEqual(1, ((CompositeOuter) arr.OutArr[0]).Inner.Val);
- Assert.AreEqual(1, ((CompositeOuter) arr.OutArr[0]).Inner.Val);
-
- portOutArr[0] = _grid.GetBinary().GetBuilder(typeof(CompositeOuter))
- .SetField("inner", new CompositeInner(2)).Build();
-
- portObj = _grid.GetBinary().GetBuilder(portObj).SetHashCode(200)
- .SetField("outArr", portOutArr.ToArray<object>()).Build();
-
- Assert.AreEqual(200, portObj.GetHashCode());
-
- portInArr = portObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
-
- Assert.AreEqual(2, portInArr.Length);
- Assert.AreEqual(2, portOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
- Assert.AreEqual(1, portOutArr[1].GetField<IBinaryObject>("inner").GetField<int>("val"));
-
- arr = portObj.Deserialize<CompositeArray>();
-
- Assert.IsNull(arr.InArr);
- Assert.AreEqual(2, arr.OutArr.Length);
- Assert.AreEqual(2, ((CompositeOuter)arr.OutArr[0]).Inner.Val);
- Assert.AreEqual(1, ((CompositeOuter)arr.OutArr[1]).Inner.Val);
- }
-
- /// <summary>
- /// Test container types other than array.
- /// </summary>
- [Test]
- public void TestCompositeContainer()
- {
- ArrayList col = new ArrayList();
- IDictionary dict = new Hashtable();
-
- col.Add(new CompositeInner(1));
- dict[3] = new CompositeInner(3);
-
- IBinaryObject portObj = _grid.GetBinary().GetBuilder(typeof(CompositeContainer)).SetHashCode(100)
- .SetCollectionField("col", col)
- .SetDictionaryField("dict", dict).Build();
-
- // 1. Check meta.
- IBinaryType meta = portObj.GetBinaryType();
-
- Assert.AreEqual(typeof(CompositeContainer).Name, meta.TypeName);
-
- Assert.AreEqual(2, meta.Fields.Count);
- Assert.AreEqual(BinaryTypeNames.TypeNameCollection, meta.GetFieldTypeName("col"));
- Assert.AreEqual(BinaryTypeNames.TypeNameMap, meta.GetFieldTypeName("dict"));
-
- // 2. Check in portable form.
- Assert.AreEqual(1, portObj.GetField<ICollection>("col").Count);
- Assert.AreEqual(1, portObj.GetField<ICollection>("col").OfType<IBinaryObject>().First()
- .GetField<int>("val"));
-
- Assert.AreEqual(1, portObj.GetField<IDictionary>("dict").Count);
- Assert.AreEqual(3, ((IBinaryObject) portObj.GetField<IDictionary>("dict")[3]).GetField<int>("val"));
-
- // 3. Check in deserialized form.
- CompositeContainer obj = portObj.Deserialize<CompositeContainer>();
-
- Assert.AreEqual(1, obj.Col.Count);
- Assert.AreEqual(1, obj.Col.OfType<CompositeInner>().First().Val);
-
- Assert.AreEqual(1, obj.Dict.Count);
- Assert.AreEqual(3, ((CompositeInner) obj.Dict[3]).Val);
- }
-
- /// <summary>
- /// Ensure that raw data is not lost during build.
- /// </summary>
- [Test]
- public void TestRawData()
- {
- var raw = new WithRaw
- {
- A = 1,
- B = 2
- };
-
- var portObj = _marsh.Unmarshal<IBinaryObject>(_marsh.Marshal(raw), BinaryMode.ForceBinary);
-
- raw = portObj.Deserialize<WithRaw>();
-
- Assert.AreEqual(1, raw.A);
- Assert.AreEqual(2, raw.B);
-
- IBinaryObject newPortObj = _grid.GetBinary().GetBuilder(portObj).SetField("a", 3).Build();
-
- raw = newPortObj.Deserialize<WithRaw>();
-
- Assert.AreEqual(3, raw.A);
- Assert.AreEqual(2, raw.B);
- }
-
- /// <summary>
- /// Test nested objects.
- /// </summary>
- [Test]
- public void TestNested()
- {
- // 1. Create from scratch.
- IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(NestedOuter));
-
- NestedInner inner1 = new NestedInner {Val = 1};
- builder.SetField("inner1", inner1);
-
- IBinaryObject outerPortObj = builder.Build();
-
- IBinaryType meta = outerPortObj.GetBinaryType();
-
- Assert.AreEqual(typeof(NestedOuter).Name, meta.TypeName);
- Assert.AreEqual(1, meta.Fields.Count);
- Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner1"));
-
- IBinaryObject innerPortObj1 = outerPortObj.GetField<IBinaryObject>("inner1");
-
- IBinaryType innerMeta = innerPortObj1.GetBinaryType();
-
- Assert.AreEqual(typeof(NestedInner).Name, innerMeta.TypeName);
- Assert.AreEqual(1, innerMeta.Fields.Count);
- Assert.AreEqual(BinaryTypeNames.TypeNameInt, innerMeta.GetFieldTypeName("Val"));
-
- inner1 = innerPortObj1.Deserialize<NestedInner>();
-
- Assert.AreEqual(1, inner1.Val);
-
- NestedOuter outer = outerPortObj.Deserialize<NestedOuter>();
- Assert.AreEqual(outer.Inner1.Val, 1);
- Assert.IsNull(outer.Inner2);
-
- // 2. Add another field over existing portable object.
- builder = _grid.GetBinary().GetBuilder(outerPortObj);
-
- NestedInner inner2 = new NestedInner {Val = 2};
- builder.SetField("inner2", inner2);
-
- outerPortObj = builder.Build();
-
- outer = outerPortObj.Deserialize<NestedOuter>();
- Assert.AreEqual(1, outer.Inner1.Val);
- Assert.AreEqual(2, outer.Inner2.Val);
-
- // 3. Try setting inner object in portable form.
- innerPortObj1 = _grid.GetBinary().GetBuilder(innerPortObj1).SetField("val", 3).Build();
-
- inner1 = innerPortObj1.Deserialize<NestedInner>();
-
- Assert.AreEqual(3, inner1.Val);
-
- outerPortObj = _grid.GetBinary().GetBuilder(outerPortObj).SetField<object>("inner1", innerPortObj1).Build();
-
- outer = outerPortObj.Deserialize<NestedOuter>();
- Assert.AreEqual(3, outer.Inner1.Val);
- Assert.AreEqual(2, outer.Inner2.Val);
- }
-
- /// <summary>
- /// Test handle migration.
- /// </summary>
- [Test]
- public void TestHandleMigration()
- {
- // 1. Simple comparison of results.
- MigrationInner inner = new MigrationInner {Val = 1};
-
- MigrationOuter outer = new MigrationOuter
- {
- Inner1 = inner,
- Inner2 = inner
- };
-
- byte[] outerBytes = _marsh.Marshal(outer);
-
- IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(MigrationOuter));
-
- builder.SetHashCode(outer.GetHashCode());
-
- builder.SetField<object>("inner1", inner);
- builder.SetField<object>("inner2", inner);
-
- BinaryObject portOuter = (BinaryObject) builder.Build();
-
- byte[] portOuterBytes = new byte[outerBytes.Length];
-
- Buffer.BlockCopy(portOuter.Data, 0, portOuterBytes, 0, portOuterBytes.Length);
-
- Assert.AreEqual(outerBytes, portOuterBytes);
-
- // 2. Change the first inner object so that the handle must migrate.
- MigrationInner inner1 = new MigrationInner {Val = 2};
-
- IBinaryObject portOuterMigrated =
- _grid.GetBinary().GetBuilder(portOuter).SetField<object>("inner1", inner1).Build();
-
- MigrationOuter outerMigrated = portOuterMigrated.Deserialize<MigrationOuter>();
-
- Assert.AreEqual(2, outerMigrated.Inner1.Val);
- Assert.AreEqual(1, outerMigrated.Inner2.Val);
-
- // 3. Change the first value using serialized form.
- IBinaryObject inner1Port =
- _grid.GetBinary().GetBuilder(typeof(MigrationInner)).SetField("val", 2).Build();
-
- portOuterMigrated =
- _grid.GetBinary().GetBuilder(portOuter).SetField<object>("inner1", inner1Port).Build();
-
- outerMigrated = portOuterMigrated.Deserialize<MigrationOuter>();
-
- Assert.AreEqual(2, outerMigrated.Inner1.Val);
- Assert.AreEqual(1, outerMigrated.Inner2.Val);
- }
-
- /// <summary>
- /// Test handle inversion.
- /// </summary>
- [Test]
- public void TestHandleInversion()
- {
- InversionInner inner = new InversionInner();
- InversionOuter outer = new InversionOuter();
-
- inner.Outer = outer;
- outer.Inner = inner;
-
- byte[] rawOuter = _marsh.Marshal(outer);
-
- IBinaryObject portOuter = _marsh.Unmarshal<IBinaryObject>(rawOuter, BinaryMode.ForceBinary);
- IBinaryObject portInner = portOuter.GetField<IBinaryObject>("inner");
-
- // 1. Ensure that inner object can be deserialized after build.
- IBinaryObject portInnerNew = _grid.GetBinary().GetBuilder(portInner).Build();
-
- InversionInner innerNew = portInnerNew.Deserialize<InversionInner>();
-
- Assert.AreSame(innerNew, innerNew.Outer.Inner);
-
- // 2. Ensure that portable object with external dependencies could be added to builder.
- IBinaryObject portOuterNew =
- _grid.GetBinary().GetBuilder(typeof(InversionOuter)).SetField<object>("inner", portInner).Build();
-
- InversionOuter outerNew = portOuterNew.Deserialize<InversionOuter>();
-
- Assert.AreNotSame(outerNew, outerNew.Inner.Outer);
- Assert.AreSame(outerNew.Inner, outerNew.Inner.Outer.Inner);
- }
-
- /// <summary>
- /// Test build multiple objects.
- /// </summary>
- [Test]
- public void TestBuildMultiple()
- {
- IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(Primitives));
-
- builder.SetField<byte>("fByte", 1).SetField("fBool", true);
-
- IBinaryObject po1 = builder.Build();
- IBinaryObject po2 = builder.Build();
-
- Assert.AreEqual(1, po1.GetField<byte>("fByte"));
- Assert.AreEqual(true, po1.GetField<bool>("fBool"));
-
- Assert.AreEqual(1, po2.GetField<byte>("fByte"));
- Assert.AreEqual(true, po2.GetField<bool>("fBool"));
-
- builder.SetField<byte>("fByte", 2);
-
- IBinaryObject po3 = builder.Build();
-
- Assert.AreEqual(1, po1.GetField<byte>("fByte"));
- Assert.AreEqual(true, po1.GetField<bool>("fBool"));
-
- Assert.AreEqual(1, po2.GetField<byte>("fByte"));
- Assert.AreEqual(true, po2.GetField<bool>("fBool"));
-
- Assert.AreEqual(2, po3.GetField<byte>("fByte"));
- Assert.AreEqual(true, po2.GetField<bool>("fBool"));
-
- builder = _grid.GetBinary().GetBuilder(po1);
-
- builder.SetField<byte>("fByte", 10);
-
- po1 = builder.Build();
- po2 = builder.Build();
-
- builder.SetField<byte>("fByte", 20);
-
- po3 = builder.Build();
-
- Assert.AreEqual(10, po1.GetField<byte>("fByte"));
- Assert.AreEqual(true, po1.GetField<bool>("fBool"));
-
- Assert.AreEqual(10, po2.GetField<byte>("fByte"));
- Assert.AreEqual(true, po2.GetField<bool>("fBool"));
-
- Assert.AreEqual(20, po3.GetField<byte>("fByte"));
- Assert.AreEqual(true, po3.GetField<bool>("fBool"));
- }
-
- /// <summary>
- /// Tests type id method.
- /// </summary>
- [Test]
- public void TestTypeId()
- {
- Assert.Throws<ArgumentException>(() => _grid.GetBinary().GetTypeId(null));
-
- Assert.AreEqual(IdMapper.TestTypeId, _grid.GetBinary().GetTypeId(IdMapper.TestTypeName));
-
- Assert.AreEqual(BinaryUtils.GetStringHashCode("someTypeName"), _grid.GetBinary().GetTypeId("someTypeName"));
- }
-
- /// <summary>
- /// Tests metadata methods.
- /// </summary>
- [Test]
- public void TestMetadata()
- {
- // Populate metadata
- var portables = _grid.GetBinary();
-
- portables.ToBinary<IBinaryObject>(new DecimalHolder());
-
- // All meta
- var allMetas = portables.GetBinaryTypes();
-
- var decimalMeta = allMetas.Single(x => x.TypeName == "DecimalHolder");
-
- Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
-
- // By type
- decimalMeta = portables.GetBinaryType(typeof (DecimalHolder));
-
- Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
-
- // By type id
- decimalMeta = portables.GetBinaryType(portables.GetTypeId("DecimalHolder"));
-
- Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
-
- // By type name
- decimalMeta = portables.GetBinaryType("DecimalHolder");
-
- Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
- }
-
- /// <summary>
- /// Create portable type configuration with disabled metadata.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <returns>Configuration.</returns>
- private static BinaryTypeConfiguration TypeConfigurationNoMeta(Type typ)
- {
- return new BinaryTypeConfiguration(typ);
- }
- }
-
- /// <summary>
- /// Empty portable class.
- /// </summary>
- public class Empty
- {
- // No-op.
- }
-
- /// <summary>
- /// Empty portable class with no metadata.
- /// </summary>
- public class EmptyNoMeta
- {
- // No-op.
- }
-
- /// <summary>
- /// Portable with primitive fields.
- /// </summary>
- public class Primitives
- {
- public byte FByte;
- public bool FBool;
- public short FShort;
- public char FChar;
- public int FInt;
- public long FLong;
- public float FFloat;
- public double FDouble;
- }
-
- /// <summary>
- /// Portable with primitive array fields.
- /// </summary>
- public class PrimitiveArrays
- {
- public byte[] FByte;
- public bool[] FBool;
- public short[] FShort;
- public char[] FChar;
- public int[] FInt;
- public long[] FLong;
- public float[] FFloat;
- public double[] FDouble;
- }
-
- /// <summary>
- /// Portable having strings, dates, Guids and enums.
- /// </summary>
- public class StringDateGuidEnum
- {
- public string FStr;
- public DateTime? FnDate;
- public Guid? FnGuid;
- public TestEnum FEnum;
-
- public string[] FStrArr;
- public DateTime?[] FDateArr;
- public Guid?[] FGuidArr;
- public TestEnum[] FEnumArr;
- }
-
- /// <summary>
- /// Enumeration.
- /// </summary>
- public enum TestEnum
- {
- One, Two
- }
-
- /// <summary>
- /// Portable with raw data.
- /// </summary>
- public class WithRaw : IBinarizable
- {
- public int A;
- public int B;
-
- /** <inheritDoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteInt("a", A);
- writer.GetRawWriter().WriteInt(B);
- }
-
- /** <inheritDoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- A = reader.ReadInt("a");
- B = reader.GetRawReader().ReadInt();
- }
- }
-
- /// <summary>
- /// Empty class for metadata overwrite test.
- /// </summary>
- public class MetaOverwrite
- {
- // No-op.
- }
-
- /// <summary>
- /// Nested outer object.
- /// </summary>
- public class NestedOuter
- {
- public NestedInner Inner1;
- public NestedInner Inner2;
- }
-
- /// <summary>
- /// Nested inner object.
- /// </summary>
- public class NestedInner
- {
- public int Val;
- }
-
- /// <summary>
- /// Outer object for handle migration test.
- /// </summary>
- public class MigrationOuter
- {
- public MigrationInner Inner1;
- public MigrationInner Inner2;
- }
-
- /// <summary>
- /// Inner object for handle migration test.
- /// </summary>
- public class MigrationInner
- {
- public int Val;
- }
-
- /// <summary>
- /// Outer object for handle inversion test.
- /// </summary>
- public class InversionOuter
- {
- public InversionInner Inner;
- }
-
- /// <summary>
- /// Inner object for handle inversion test.
- /// </summary>
- public class InversionInner
- {
- public InversionOuter Outer;
- }
-
- /// <summary>
- /// Object for composite array tests.
- /// </summary>
- public class CompositeArray
- {
- public object[] InArr;
- public object[] OutArr;
- }
-
- /// <summary>
- /// Object for composite collection/dictionary tests.
- /// </summary>
- public class CompositeContainer
- {
- public ICollection Col;
- public IDictionary Dict;
- }
-
- /// <summary>
- /// OUter object for composite structures test.
- /// </summary>
- public class CompositeOuter
- {
- public CompositeInner Inner;
-
- public CompositeOuter()
- {
- // No-op.
- }
-
- public CompositeOuter(CompositeInner inner)
- {
- Inner = inner;
- }
- }
-
- /// <summary>
- /// Inner object for composite structures test.
- /// </summary>
- public class CompositeInner
- {
- public int Val;
-
- public CompositeInner()
- {
- // No-op.
- }
-
- public CompositeInner(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- /// Type to test "ToPortable()" logic.
- /// </summary>
- public class ToPortable
- {
- public int Val;
-
- public ToPortable(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- /// Type to test "ToPortable()" logic with metadata disabled.
- /// </summary>
- public class ToPortableNoMeta
- {
- public int Val;
-
- public ToPortableNoMeta(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- /// Type to test removal.
- /// </summary>
- public class Remove
- {
- public object Val;
- public RemoveInner Val2;
- }
-
- /// <summary>
- /// Inner type to test removal.
- /// </summary>
- public class RemoveInner
- {
- /** */
- public int Val;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="val"></param>
- public RemoveInner(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BuilderInBuilderOuter
- {
- /** */
- public BuilderInBuilderInner Inner;
-
- /** */
- public BuilderInBuilderInner Inner2;
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BuilderInBuilderInner
- {
- /** */
- public BuilderInBuilderOuter Outer;
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BuilderCollection
- {
- /** */
- public readonly ArrayList Col;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="col"></param>
- public BuilderCollection(ArrayList col)
- {
- Col = col;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BuilderCollectionItem
- {
- /** */
- public int Val;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="val"></param>
- public BuilderCollectionItem(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class DecimalHolder
- {
- /** */
- public decimal Val;
-
- /** */
- public decimal?[] ValArr;
- }
-
- /// <summary>
- /// Test id mapper.
- /// </summary>
- public class IdMapper : IBinaryIdMapper
- {
- /** */
- public const string TestTypeName = "IdMapperTestType";
-
- /** */
- public const int TestTypeId = -65537;
-
- /** <inheritdoc /> */
- public int GetTypeId(string typeName)
- {
- return typeName == TestTypeName ? TestTypeId : 0;
- }
-
- /** <inheritdoc /> */
- public int GetFieldId(int typeId, string fieldName)
- {
- return 0;
- }
- }
-}
[43/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
new file mode 100644
index 0000000..ea472eb
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -0,0 +1,1721 @@
+/*
+ * 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.
+ */
+
+// ReSharper disable UnassignedField.Global
+// ReSharper disable CollectionNeverUpdated.Global
+namespace Apache.Ignite.Core.Tests.Binary
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Binary;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Binary builder self test.
+ /// </summary>
+ public class BinaryBuilderSelfTest
+ {
+ /** Undefined type: Empty. */
+ private const string TypeEmpty = "EmptyUndefined";
+
+ /** Grid. */
+ private Ignite _grid;
+
+ /** Marshaller. */
+ private Marshaller _marsh;
+
+ /// <summary>
+ /// Set up routine.
+ /// </summary>
+ [TestFixtureSetUp]
+ public void SetUp()
+ {
+ TestUtils.KillProcesses();
+
+ var cfg = new IgniteConfiguration
+ {
+ BinaryConfiguration = new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (Empty)),
+ new BinaryTypeConfiguration(typeof (Primitives)),
+ new BinaryTypeConfiguration(typeof (PrimitiveArrays)),
+ new BinaryTypeConfiguration(typeof (StringDateGuidEnum)),
+ new BinaryTypeConfiguration(typeof (WithRaw)),
+ new BinaryTypeConfiguration(typeof (MetaOverwrite)),
+ new BinaryTypeConfiguration(typeof (NestedOuter)),
+ new BinaryTypeConfiguration(typeof (NestedInner)),
+ new BinaryTypeConfiguration(typeof (MigrationOuter)),
+ new BinaryTypeConfiguration(typeof (MigrationInner)),
+ new BinaryTypeConfiguration(typeof (InversionOuter)),
+ new BinaryTypeConfiguration(typeof (InversionInner)),
+ new BinaryTypeConfiguration(typeof (CompositeOuter)),
+ new BinaryTypeConfiguration(typeof (CompositeInner)),
+ new BinaryTypeConfiguration(typeof (CompositeArray)),
+ new BinaryTypeConfiguration(typeof (CompositeContainer)),
+ new BinaryTypeConfiguration(typeof (ToBinary)),
+ new BinaryTypeConfiguration(typeof (Remove)),
+ new BinaryTypeConfiguration(typeof (RemoveInner)),
+ new BinaryTypeConfiguration(typeof (BuilderInBuilderOuter)),
+ new BinaryTypeConfiguration(typeof (BuilderInBuilderInner)),
+ new BinaryTypeConfiguration(typeof (BuilderCollection)),
+ new BinaryTypeConfiguration(typeof (BuilderCollectionItem)),
+ new BinaryTypeConfiguration(typeof (DecimalHolder)),
+ new BinaryTypeConfiguration(TypeEmpty)
+ },
+ DefaultIdMapper = new IdMapper()
+ },
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = new List<string>
+ {
+ "-ea",
+ "-Xcheck:jni",
+ "-Xms4g",
+ "-Xmx4g",
+ "-DIGNITE_QUIET=false",
+ "-Xnoagent",
+ "-Djava.compiler=NONE",
+ "-Xdebug",
+ "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005",
+ "-XX:+HeapDumpOnOutOfMemoryError"
+ },
+ SpringConfigUrl = "config\\binary.xml"
+ };
+
+ _grid = (Ignite) Ignition.Start(cfg);
+
+ _marsh = _grid.Marshaller;
+ }
+
+ /// <summary>
+ /// Tear down routine.
+ /// </summary>
+ [TestFixtureTearDown]
+ public virtual void TearDown()
+ {
+ if (_grid != null)
+ Ignition.Stop(_grid.Name, true);
+
+ _grid = null;
+ }
+
+ /// <summary>
+ /// Ensure that binary engine is able to work with type names, which are not configured.
+ /// </summary>
+ [Test]
+ public void TestNonConfigured()
+ {
+ string typeName1 = "Type1";
+ string typeName2 = "Type2";
+ string field1 = "field1";
+ string field2 = "field2";
+
+ // 1. Ensure that builder works fine.
+ IBinaryObject binObj1 = _grid.GetBinary().GetBuilder(typeName1).SetField(field1, 1).Build();
+
+ Assert.AreEqual(typeName1, binObj1.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj1.GetBinaryType().Fields.Count);
+ Assert.AreEqual(field1, binObj1.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, binObj1.GetBinaryType().GetFieldTypeName(field1));
+
+ Assert.AreEqual(1, binObj1.GetField<int>(field1));
+
+ // 2. Ensure that object can be unmarshalled without deserialization.
+ byte[] data = ((BinaryObject) binObj1).Data;
+
+ binObj1 = _grid.Marshaller.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(typeName1, binObj1.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj1.GetBinaryType().Fields.Count);
+ Assert.AreEqual(field1, binObj1.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, binObj1.GetBinaryType().GetFieldTypeName(field1));
+
+ Assert.AreEqual(1, binObj1.GetField<int>(field1));
+
+ // 3. Ensure that we can nest one anonymous object inside another
+ IBinaryObject binObj2 =
+ _grid.GetBinary().GetBuilder(typeName2).SetField(field2, binObj1).Build();
+
+ Assert.AreEqual(typeName2, binObj2.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj2.GetBinaryType().Fields.Count);
+ Assert.AreEqual(field2, binObj2.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, binObj2.GetBinaryType().GetFieldTypeName(field2));
+
+ binObj1 = binObj2.GetField<IBinaryObject>(field2);
+
+ Assert.AreEqual(typeName1, binObj1.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj1.GetBinaryType().Fields.Count);
+ Assert.AreEqual(field1, binObj1.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, binObj1.GetBinaryType().GetFieldTypeName(field1));
+
+ Assert.AreEqual(1, binObj1.GetField<int>(field1));
+
+ // 4. Ensure that we can unmarshal object with other nested object.
+ data = ((BinaryObject) binObj2).Data;
+
+ binObj2 = _grid.Marshaller.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(typeName2, binObj2.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj2.GetBinaryType().Fields.Count);
+ Assert.AreEqual(field2, binObj2.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, binObj2.GetBinaryType().GetFieldTypeName(field2));
+
+ binObj1 = binObj2.GetField<IBinaryObject>(field2);
+
+ Assert.AreEqual(typeName1, binObj1.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj1.GetBinaryType().Fields.Count);
+ Assert.AreEqual(field1, binObj1.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, binObj1.GetBinaryType().GetFieldTypeName(field1));
+
+ Assert.AreEqual(1, binObj1.GetField<int>(field1));
+ }
+
+ /// <summary>
+ /// Test "ToBinary()" method.
+ /// </summary>
+ [Test]
+ public void TestToBinary()
+ {
+ DateTime date = DateTime.Now.ToUniversalTime();
+ Guid guid = Guid.NewGuid();
+
+ IIgniteBinary api = _grid.GetBinary();
+
+ // 1. Primitives.
+ Assert.AreEqual(1, api.ToBinary<byte>((byte)1));
+ Assert.AreEqual(1, api.ToBinary<short>((short)1));
+ Assert.AreEqual(1, api.ToBinary<int>(1));
+ Assert.AreEqual(1, api.ToBinary<long>((long)1));
+
+ Assert.AreEqual((float)1, api.ToBinary<float>((float)1));
+ Assert.AreEqual((double)1, api.ToBinary<double>((double)1));
+
+ Assert.AreEqual(true, api.ToBinary<bool>(true));
+ Assert.AreEqual('a', api.ToBinary<char>('a'));
+
+ // 2. Special types.
+ Assert.AreEqual("a", api.ToBinary<string>("a"));
+ Assert.AreEqual(date, api.ToBinary<DateTime>(date));
+ Assert.AreEqual(guid, api.ToBinary<Guid>(guid));
+ Assert.AreEqual(TestEnum.One, api.ToBinary<TestEnum>(TestEnum.One));
+
+ // 3. Arrays.
+ Assert.AreEqual(new byte[] { 1 }, api.ToBinary<byte[]>(new byte[] { 1 }));
+ Assert.AreEqual(new short[] { 1 }, api.ToBinary<short[]>(new short[] { 1 }));
+ Assert.AreEqual(new[] { 1 }, api.ToBinary<int[]>(new[] { 1 }));
+ Assert.AreEqual(new long[] { 1 }, api.ToBinary<long[]>(new long[] { 1 }));
+
+ Assert.AreEqual(new float[] { 1 }, api.ToBinary<float[]>(new float[] { 1 }));
+ Assert.AreEqual(new double[] { 1 }, api.ToBinary<double[]>(new double[] { 1 }));
+
+ Assert.AreEqual(new[] { true }, api.ToBinary<bool[]>(new[] { true }));
+ Assert.AreEqual(new[] { 'a' }, api.ToBinary<char[]>(new[] { 'a' }));
+
+ Assert.AreEqual(new[] { "a" }, api.ToBinary<string[]>(new[] { "a" }));
+ Assert.AreEqual(new[] { date }, api.ToBinary<DateTime[]>(new[] { date }));
+ Assert.AreEqual(new[] { guid }, api.ToBinary<Guid[]>(new[] { guid }));
+ Assert.AreEqual(new[] { TestEnum.One }, api.ToBinary<TestEnum[]>(new[] { TestEnum.One }));
+
+ // 4. Objects.
+ IBinaryObject binObj = api.ToBinary<IBinaryObject>(new ToBinary(1));
+
+ Assert.AreEqual(typeof(ToBinary).Name, binObj.GetBinaryType().TypeName);
+ Assert.AreEqual(1, binObj.GetBinaryType().Fields.Count);
+ Assert.AreEqual("Val", binObj.GetBinaryType().Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, binObj.GetBinaryType().GetFieldTypeName("Val"));
+
+ Assert.AreEqual(1, binObj.GetField<int>("val"));
+ Assert.AreEqual(1, binObj.Deserialize<ToBinary>().Val);
+
+ // 5. Object array.
+ var binObjArr = api.ToBinary<object[]>(new object[] {new ToBinary(1)})
+ .OfType<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(1, binObjArr.Length);
+ Assert.AreEqual(1, binObjArr[0].GetField<int>("Val"));
+ Assert.AreEqual(1, binObjArr[0].Deserialize<ToBinary>().Val);
+ }
+
+ /// <summary>
+ /// Test builder field remove logic.
+ /// </summary>
+ [Test]
+ public void TestRemove()
+ {
+ // Create empty object.
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(Remove)).Build();
+
+ Assert.IsNull(binObj.GetField<object>("val"));
+ Assert.IsNull(binObj.Deserialize<Remove>().Val);
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(Remove).Name, meta.TypeName);
+ Assert.AreEqual(0, meta.Fields.Count);
+
+ // Populate it with field.
+ IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(binObj);
+
+ Assert.IsNull(builder.GetField<object>("val"));
+
+ object val = 1;
+
+ builder.SetField("val", val);
+
+ Assert.AreEqual(val, builder.GetField<object>("val"));
+
+ binObj = builder.Build();
+
+ Assert.AreEqual(val, binObj.GetField<object>("val"));
+ Assert.AreEqual(val, binObj.Deserialize<Remove>().Val);
+
+ meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(Remove).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual("val", meta.Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("val"));
+
+ // Perform field remove.
+ builder = _grid.GetBinary().GetBuilder(binObj);
+
+ Assert.AreEqual(val, builder.GetField<object>("val"));
+
+ builder.RemoveField("val");
+ Assert.IsNull(builder.GetField<object>("val"));
+
+ builder.SetField("val", val);
+ Assert.AreEqual(val, builder.GetField<object>("val"));
+
+ builder.RemoveField("val");
+ Assert.IsNull(builder.GetField<object>("val"));
+
+ binObj = builder.Build();
+
+ Assert.IsNull(binObj.GetField<object>("val"));
+ Assert.IsNull(binObj.Deserialize<Remove>().Val);
+
+ // Test correct removal of field being referenced by handle somewhere else.
+ RemoveInner inner = new RemoveInner(2);
+
+ binObj = _grid.GetBinary().GetBuilder(typeof(Remove))
+ .SetField("val", inner)
+ .SetField("val2", inner)
+ .Build();
+
+ binObj = _grid.GetBinary().GetBuilder(binObj).RemoveField("val").Build();
+
+ Remove obj = binObj.Deserialize<Remove>();
+
+ Assert.IsNull(obj.Val);
+ Assert.AreEqual(2, obj.Val2.Val);
+ }
+
+ /// <summary>
+ /// Test builder-in-builder scenario.
+ /// </summary>
+ [Test]
+ public void TestBuilderInBuilder()
+ {
+ // Test different builders assembly.
+ IBinaryObjectBuilder builderOuter = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderOuter));
+ IBinaryObjectBuilder builderInner = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderInner));
+
+ builderOuter.SetField<object>("inner", builderInner);
+ builderInner.SetField<object>("outer", builderOuter);
+
+ IBinaryObject outerbinObj = builderOuter.Build();
+
+ IBinaryType meta = outerbinObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(BuilderInBuilderOuter).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual("inner", meta.Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner"));
+
+ IBinaryObject innerbinObj = outerbinObj.GetField<IBinaryObject>("inner");
+
+ meta = innerbinObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(BuilderInBuilderInner).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual("outer", meta.Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("outer"));
+
+ BuilderInBuilderOuter outer = outerbinObj.Deserialize<BuilderInBuilderOuter>();
+
+ Assert.AreSame(outer, outer.Inner.Outer);
+
+ // Test same builders assembly.
+ innerbinObj = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderInner)).Build();
+
+ outerbinObj = _grid.GetBinary().GetBuilder(typeof(BuilderInBuilderOuter))
+ .SetField("inner", innerbinObj)
+ .SetField("inner2", innerbinObj)
+ .Build();
+
+ meta = outerbinObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(BuilderInBuilderOuter).Name, meta.TypeName);
+ Assert.AreEqual(2, meta.Fields.Count);
+ Assert.IsTrue(meta.Fields.Contains("inner"));
+ Assert.IsTrue(meta.Fields.Contains("inner2"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner2"));
+
+ outer = outerbinObj.Deserialize<BuilderInBuilderOuter>();
+
+ Assert.AreSame(outer.Inner, outer.Inner2);
+
+ builderOuter = _grid.GetBinary().GetBuilder(outerbinObj);
+ IBinaryObjectBuilder builderInner2 = builderOuter.GetField<IBinaryObjectBuilder>("inner2");
+
+ builderInner2.SetField("outer", builderOuter);
+
+ outerbinObj = builderOuter.Build();
+
+ outer = outerbinObj.Deserialize<BuilderInBuilderOuter>();
+
+ Assert.AreSame(outer, outer.Inner.Outer);
+ Assert.AreSame(outer.Inner, outer.Inner2);
+ }
+
+ /// <summary>
+ /// Test for decimals building.
+ /// </summary>
+ [Test]
+ public void TestDecimals()
+ {
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(DecimalHolder))
+ .SetField("val", decimal.One)
+ .SetField("valArr", new decimal?[] { decimal.MinusOne })
+ .Build();
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(DecimalHolder).Name, meta.TypeName);
+ Assert.AreEqual(2, meta.Fields.Count);
+ Assert.IsTrue(meta.Fields.Contains("val"));
+ Assert.IsTrue(meta.Fields.Contains("valArr"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameDecimal, meta.GetFieldTypeName("val"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayDecimal, meta.GetFieldTypeName("valArr"));
+
+ Assert.AreEqual(decimal.One, binObj.GetField<decimal>("val"));
+ Assert.AreEqual(new decimal?[] { decimal.MinusOne }, binObj.GetField<decimal?[]>("valArr"));
+
+ DecimalHolder obj = binObj.Deserialize<DecimalHolder>();
+
+ Assert.AreEqual(decimal.One, obj.Val);
+ Assert.AreEqual(new decimal?[] { decimal.MinusOne }, obj.ValArr);
+ }
+
+ /// <summary>
+ /// Test for an object returning collection of builders.
+ /// </summary>
+ [Test]
+ public void TestBuilderCollection()
+ {
+ // Test collection with single element.
+ IBinaryObjectBuilder builderCol = _grid.GetBinary().GetBuilder(typeof(BuilderCollection));
+ IBinaryObjectBuilder builderItem =
+ _grid.GetBinary().GetBuilder(typeof(BuilderCollectionItem)).SetField("val", 1);
+
+ builderCol.SetCollectionField("col", new ArrayList { builderItem });
+
+ IBinaryObject binCol = builderCol.Build();
+
+ IBinaryType meta = binCol.GetBinaryType();
+
+ Assert.AreEqual(typeof(BuilderCollection).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual("col", meta.Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameCollection, meta.GetFieldTypeName("col"));
+
+ var binColItems = binCol.GetField<ArrayList>("col");
+
+ Assert.AreEqual(1, binColItems.Count);
+
+ var binItem = (IBinaryObject) binColItems[0];
+
+ meta = binItem.GetBinaryType();
+
+ Assert.AreEqual(typeof(BuilderCollectionItem).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual("val", meta.Fields.First());
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, meta.GetFieldTypeName("val"));
+
+ BuilderCollection col = binCol.Deserialize<BuilderCollection>();
+
+ Assert.IsNotNull(col.Col);
+ Assert.AreEqual(1, col.Col.Count);
+ Assert.AreEqual(1, ((BuilderCollectionItem) col.Col[0]).Val);
+
+ // Add more binary objects to collection.
+ builderCol = _grid.GetBinary().GetBuilder(binCol);
+
+ IList builderColItems = builderCol.GetField<IList>("col");
+
+ Assert.AreEqual(1, builderColItems.Count);
+
+ BinaryObjectBuilder builderColItem = (BinaryObjectBuilder) builderColItems[0];
+
+ builderColItem.SetField("val", 2); // Change nested value.
+
+ builderColItems.Add(builderColItem); // Add the same object to check handles.
+ builderColItems.Add(builderItem); // Add item from another builder.
+ builderColItems.Add(binItem); // Add item in binary form.
+
+ binCol = builderCol.Build();
+
+ col = binCol.Deserialize<BuilderCollection>();
+
+ Assert.AreEqual(4, col.Col.Count);
+
+ var item0 = (BuilderCollectionItem) col.Col[0];
+ var item1 = (BuilderCollectionItem) col.Col[1];
+ var item2 = (BuilderCollectionItem) col.Col[2];
+ var item3 = (BuilderCollectionItem) col.Col[3];
+
+ Assert.AreEqual(2, item0.Val);
+
+ Assert.AreSame(item0, item1);
+ Assert.AreNotSame(item0, item2);
+ Assert.AreNotSame(item0, item3);
+
+ Assert.AreEqual(1, item2.Val);
+ Assert.AreEqual(1, item3.Val);
+
+ Assert.AreNotSame(item2, item3);
+
+ // Test handle update inside collection.
+ builderCol = _grid.GetBinary().GetBuilder(binCol);
+
+ builderColItems = builderCol.GetField<IList>("col");
+
+ ((BinaryObjectBuilder) builderColItems[1]).SetField("val", 3);
+
+ binCol = builderCol.Build();
+
+ col = binCol.Deserialize<BuilderCollection>();
+
+ item0 = (BuilderCollectionItem) col.Col[0];
+ item1 = (BuilderCollectionItem) col.Col[1];
+
+ Assert.AreEqual(3, item0.Val);
+ Assert.AreSame(item0, item1);
+ }
+
+ /// <summary>
+ /// Test build of an empty object.
+ /// </summary>
+ [Test]
+ public void TestEmptyDefined()
+ {
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(Empty)).Build();
+
+ Assert.IsNotNull(binObj);
+ Assert.AreEqual(0, binObj.GetHashCode());
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.IsNotNull(meta);
+ Assert.AreEqual(typeof(Empty).Name, meta.TypeName);
+ Assert.AreEqual(0, meta.Fields.Count);
+
+ Empty obj = binObj.Deserialize<Empty>();
+
+ Assert.IsNotNull(obj);
+ }
+
+ /// <summary>
+ /// Test build of an empty undefined object.
+ /// </summary>
+ [Test]
+ public void TestEmptyUndefined()
+ {
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(TypeEmpty).Build();
+
+ Assert.IsNotNull(binObj);
+ Assert.AreEqual(0, binObj.GetHashCode());
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.IsNotNull(meta);
+ Assert.AreEqual(TypeEmpty, meta.TypeName);
+ Assert.AreEqual(0, meta.Fields.Count);
+ }
+
+ /// <summary>
+ /// Test object rebuild with no changes.
+ /// </summary>
+ [Test]
+ public void TestEmptyRebuild()
+ {
+ var binObj = (BinaryObject) _grid.GetBinary().GetBuilder(typeof(Empty)).Build();
+
+ BinaryObject newbinObj = (BinaryObject) _grid.GetBinary().GetBuilder(binObj).Build();
+
+ Assert.AreEqual(binObj.Data, newbinObj.Data);
+ }
+
+ /// <summary>
+ /// Test hash code alteration.
+ /// </summary>
+ [Test]
+ public void TestHashCodeChange()
+ {
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(Empty)).SetHashCode(100).Build();
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+ }
+
+ /// <summary>
+ /// Test primitive fields setting.
+ /// </summary>
+ [Test]
+ public void TestPrimitiveFields()
+ {
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(Primitives))
+ .SetField<byte>("fByte", 1)
+ .SetField("fBool", true)
+ .SetField<short>("fShort", 2)
+ .SetField("fChar", 'a')
+ .SetField("fInt", 3)
+ .SetField<long>("fLong", 4)
+ .SetField<float>("fFloat", 5)
+ .SetField<double>("fDouble", 6)
+ .SetHashCode(100)
+ .Build();
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(Primitives).Name, meta.TypeName);
+
+ Assert.AreEqual(8, meta.Fields.Count);
+
+ Assert.AreEqual(BinaryTypeNames.TypeNameByte, meta.GetFieldTypeName("fByte"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameBool, meta.GetFieldTypeName("fBool"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameShort, meta.GetFieldTypeName("fShort"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameChar, meta.GetFieldTypeName("fChar"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, meta.GetFieldTypeName("fInt"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameLong, meta.GetFieldTypeName("fLong"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameFloat, meta.GetFieldTypeName("fFloat"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameDouble, meta.GetFieldTypeName("fDouble"));
+
+ Assert.AreEqual(1, binObj.GetField<byte>("fByte"));
+ Assert.AreEqual(true, binObj.GetField<bool>("fBool"));
+ Assert.AreEqual(2, binObj.GetField<short>("fShort"));
+ Assert.AreEqual('a', binObj.GetField<char>("fChar"));
+ Assert.AreEqual(3, binObj.GetField<int>("fInt"));
+ Assert.AreEqual(4, binObj.GetField<long>("fLong"));
+ Assert.AreEqual(5, binObj.GetField<float>("fFloat"));
+ Assert.AreEqual(6, binObj.GetField<double>("fDouble"));
+
+ Primitives obj = binObj.Deserialize<Primitives>();
+
+ Assert.AreEqual(1, obj.FByte);
+ Assert.AreEqual(true, obj.FBool);
+ Assert.AreEqual(2, obj.FShort);
+ Assert.AreEqual('a', obj.FChar);
+ Assert.AreEqual(3, obj.FInt);
+ Assert.AreEqual(4, obj.FLong);
+ Assert.AreEqual(5, obj.FFloat);
+ Assert.AreEqual(6, obj.FDouble);
+
+ // Overwrite.
+ binObj = _grid.GetBinary().GetBuilder(binObj)
+ .SetField<byte>("fByte", 7)
+ .SetField("fBool", false)
+ .SetField<short>("fShort", 8)
+ .SetField("fChar", 'b')
+ .SetField("fInt", 9)
+ .SetField<long>("fLong", 10)
+ .SetField<float>("fFloat", 11)
+ .SetField<double>("fDouble", 12)
+ .SetHashCode(200)
+ .Build();
+
+ Assert.AreEqual(200, binObj.GetHashCode());
+
+ Assert.AreEqual(7, binObj.GetField<byte>("fByte"));
+ Assert.AreEqual(false, binObj.GetField<bool>("fBool"));
+ Assert.AreEqual(8, binObj.GetField<short>("fShort"));
+ Assert.AreEqual('b', binObj.GetField<char>("fChar"));
+ Assert.AreEqual(9, binObj.GetField<int>("fInt"));
+ Assert.AreEqual(10, binObj.GetField<long>("fLong"));
+ Assert.AreEqual(11, binObj.GetField<float>("fFloat"));
+ Assert.AreEqual(12, binObj.GetField<double>("fDouble"));
+
+ obj = binObj.Deserialize<Primitives>();
+
+ Assert.AreEqual(7, obj.FByte);
+ Assert.AreEqual(false, obj.FBool);
+ Assert.AreEqual(8, obj.FShort);
+ Assert.AreEqual('b', obj.FChar);
+ Assert.AreEqual(9, obj.FInt);
+ Assert.AreEqual(10, obj.FLong);
+ Assert.AreEqual(11, obj.FFloat);
+ Assert.AreEqual(12, obj.FDouble);
+ }
+
+ /// <summary>
+ /// Test primitive array fields setting.
+ /// </summary>
+ [Test]
+ public void TestPrimitiveArrayFields()
+ {
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(PrimitiveArrays))
+ .SetField("fByte", new byte[] { 1 })
+ .SetField("fBool", new[] { true })
+ .SetField("fShort", new short[] { 2 })
+ .SetField("fChar", new[] { 'a' })
+ .SetField("fInt", new[] { 3 })
+ .SetField("fLong", new long[] { 4 })
+ .SetField("fFloat", new float[] { 5 })
+ .SetField("fDouble", new double[] { 6 })
+ .SetHashCode(100)
+ .Build();
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(PrimitiveArrays).Name, meta.TypeName);
+
+ Assert.AreEqual(8, meta.Fields.Count);
+
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayByte, meta.GetFieldTypeName("fByte"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayBool, meta.GetFieldTypeName("fBool"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayShort, meta.GetFieldTypeName("fShort"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayChar, meta.GetFieldTypeName("fChar"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayInt, meta.GetFieldTypeName("fInt"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayLong, meta.GetFieldTypeName("fLong"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayFloat, meta.GetFieldTypeName("fFloat"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayDouble, meta.GetFieldTypeName("fDouble"));
+
+ Assert.AreEqual(new byte[] { 1 }, binObj.GetField<byte[]>("fByte"));
+ Assert.AreEqual(new[] { true }, binObj.GetField<bool[]>("fBool"));
+ Assert.AreEqual(new short[] { 2 }, binObj.GetField<short[]>("fShort"));
+ Assert.AreEqual(new[] { 'a' }, binObj.GetField<char[]>("fChar"));
+ Assert.AreEqual(new[] { 3 }, binObj.GetField<int[]>("fInt"));
+ Assert.AreEqual(new long[] { 4 }, binObj.GetField<long[]>("fLong"));
+ Assert.AreEqual(new float[] { 5 }, binObj.GetField<float[]>("fFloat"));
+ Assert.AreEqual(new double[] { 6 }, binObj.GetField<double[]>("fDouble"));
+
+ PrimitiveArrays obj = binObj.Deserialize<PrimitiveArrays>();
+
+ Assert.AreEqual(new byte[] { 1 }, obj.FByte);
+ Assert.AreEqual(new[] { true }, obj.FBool);
+ Assert.AreEqual(new short[] { 2 }, obj.FShort);
+ Assert.AreEqual(new[] { 'a' }, obj.FChar);
+ Assert.AreEqual(new[] { 3 }, obj.FInt);
+ Assert.AreEqual(new long[] { 4 }, obj.FLong);
+ Assert.AreEqual(new float[] { 5 }, obj.FFloat);
+ Assert.AreEqual(new double[] { 6 }, obj.FDouble);
+
+ // Overwrite.
+ binObj = _grid.GetBinary().GetBuilder(binObj)
+ .SetField("fByte", new byte[] { 7 })
+ .SetField("fBool", new[] { false })
+ .SetField("fShort", new short[] { 8 })
+ .SetField("fChar", new[] { 'b' })
+ .SetField("fInt", new[] { 9 })
+ .SetField("fLong", new long[] { 10 })
+ .SetField("fFloat", new float[] { 11 })
+ .SetField("fDouble", new double[] { 12 })
+ .SetHashCode(200)
+ .Build();
+
+ Assert.AreEqual(200, binObj.GetHashCode());
+
+ Assert.AreEqual(new byte[] { 7 }, binObj.GetField<byte[]>("fByte"));
+ Assert.AreEqual(new[] { false }, binObj.GetField<bool[]>("fBool"));
+ Assert.AreEqual(new short[] { 8 }, binObj.GetField<short[]>("fShort"));
+ Assert.AreEqual(new[] { 'b' }, binObj.GetField<char[]>("fChar"));
+ Assert.AreEqual(new[] { 9 }, binObj.GetField<int[]>("fInt"));
+ Assert.AreEqual(new long[] { 10 }, binObj.GetField<long[]>("fLong"));
+ Assert.AreEqual(new float[] { 11 }, binObj.GetField<float[]>("fFloat"));
+ Assert.AreEqual(new double[] { 12 }, binObj.GetField<double[]>("fDouble"));
+
+ obj = binObj.Deserialize<PrimitiveArrays>();
+
+ Assert.AreEqual(new byte[] { 7 }, obj.FByte);
+ Assert.AreEqual(new[] { false }, obj.FBool);
+ Assert.AreEqual(new short[] { 8 }, obj.FShort);
+ Assert.AreEqual(new[] { 'b' }, obj.FChar);
+ Assert.AreEqual(new[] { 9 }, obj.FInt);
+ Assert.AreEqual(new long[] { 10 }, obj.FLong);
+ Assert.AreEqual(new float[] { 11 }, obj.FFloat);
+ Assert.AreEqual(new double[] { 12 }, obj.FDouble);
+ }
+
+ /// <summary>
+ /// Test non-primitive fields and their array counterparts.
+ /// </summary>
+ [Test]
+ public void TestStringDateGuidEnum()
+ {
+ DateTime? nDate = DateTime.Now;
+
+ Guid? nGuid = Guid.NewGuid();
+
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(StringDateGuidEnum))
+ .SetField("fStr", "str")
+ .SetField("fNDate", nDate)
+ .SetGuidField("fNGuid", nGuid)
+ .SetField("fEnum", TestEnum.One)
+ .SetField("fStrArr", new[] { "str" })
+ .SetArrayField("fDateArr", new[] { nDate })
+ .SetGuidArrayField("fGuidArr", new[] { nGuid })
+ .SetField("fEnumArr", new[] { TestEnum.One })
+ .SetHashCode(100)
+ .Build();
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(StringDateGuidEnum).Name, meta.TypeName);
+
+ Assert.AreEqual(8, meta.Fields.Count);
+
+ Assert.AreEqual(BinaryTypeNames.TypeNameString, meta.GetFieldTypeName("fStr"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("fNDate"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameGuid, meta.GetFieldTypeName("fNGuid"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameEnum, meta.GetFieldTypeName("fEnum"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayString, meta.GetFieldTypeName("fStrArr"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("fDateArr"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayGuid, meta.GetFieldTypeName("fGuidArr"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayEnum, meta.GetFieldTypeName("fEnumArr"));
+
+ Assert.AreEqual("str", binObj.GetField<string>("fStr"));
+ Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNDate"));
+ Assert.AreEqual(nGuid, binObj.GetField<Guid?>("fNGuid"));
+ Assert.AreEqual(TestEnum.One, binObj.GetField<TestEnum>("fEnum"));
+ Assert.AreEqual(new[] { "str" }, binObj.GetField<string[]>("fStrArr"));
+ Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
+ Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
+ Assert.AreEqual(new[] { TestEnum.One }, binObj.GetField<TestEnum[]>("fEnumArr"));
+
+ StringDateGuidEnum obj = binObj.Deserialize<StringDateGuidEnum>();
+
+ Assert.AreEqual("str", obj.FStr);
+ Assert.AreEqual(nDate, obj.FnDate);
+ Assert.AreEqual(nGuid, obj.FnGuid);
+ Assert.AreEqual(TestEnum.One, obj.FEnum);
+ Assert.AreEqual(new[] { "str" }, obj.FStrArr);
+ Assert.AreEqual(new[] { nDate }, obj.FDateArr);
+ Assert.AreEqual(new[] { nGuid }, obj.FGuidArr);
+ Assert.AreEqual(new[] { TestEnum.One }, obj.FEnumArr);
+
+ // Check builder field caching.
+ var builder = _grid.GetBinary().GetBuilder(binObj);
+
+ Assert.AreEqual("str", builder.GetField<string>("fStr"));
+ Assert.AreEqual(nDate, builder.GetField<DateTime?>("fNDate"));
+ Assert.AreEqual(nGuid, builder.GetField<Guid?>("fNGuid"));
+ Assert.AreEqual(TestEnum.One, builder.GetField<TestEnum>("fEnum"));
+ Assert.AreEqual(new[] { "str" }, builder.GetField<string[]>("fStrArr"));
+ Assert.AreEqual(new[] { nDate }, builder.GetField<DateTime?[]>("fDateArr"));
+ Assert.AreEqual(new[] { nGuid }, builder.GetField<Guid?[]>("fGuidArr"));
+ Assert.AreEqual(new[] { TestEnum.One }, builder.GetField<TestEnum[]>("fEnumArr"));
+
+ // Check reassemble.
+ binObj = builder.Build();
+
+ Assert.AreEqual("str", binObj.GetField<string>("fStr"));
+ Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNDate"));
+ Assert.AreEqual(nGuid, binObj.GetField<Guid?>("fNGuid"));
+ Assert.AreEqual(TestEnum.One, binObj.GetField<TestEnum>("fEnum"));
+ Assert.AreEqual(new[] { "str" }, binObj.GetField<string[]>("fStrArr"));
+ Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
+ Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
+ Assert.AreEqual(new[] { TestEnum.One }, binObj.GetField<TestEnum[]>("fEnumArr"));
+
+ obj = binObj.Deserialize<StringDateGuidEnum>();
+
+ Assert.AreEqual("str", obj.FStr);
+ Assert.AreEqual(nDate, obj.FnDate);
+ Assert.AreEqual(nGuid, obj.FnGuid);
+ Assert.AreEqual(TestEnum.One, obj.FEnum);
+ Assert.AreEqual(new[] { "str" }, obj.FStrArr);
+ Assert.AreEqual(new[] { nDate }, obj.FDateArr);
+ Assert.AreEqual(new[] { nGuid }, obj.FGuidArr);
+ Assert.AreEqual(new[] { TestEnum.One }, obj.FEnumArr);
+
+ // Overwrite.
+ nDate = DateTime.Now.ToUniversalTime();
+ nGuid = Guid.NewGuid();
+
+ binObj = builder
+ .SetField("fStr", "str2")
+ .SetTimestampField("fNDate", nDate)
+ .SetField("fNGuid", nGuid)
+ .SetField("fEnum", TestEnum.Two)
+ .SetField("fStrArr", new[] { "str2" })
+ .SetArrayField("fDateArr", new[] { nDate })
+ .SetField("fGuidArr", new[] { nGuid })
+ .SetField("fEnumArr", new[] { TestEnum.Two })
+ .SetHashCode(200)
+ .Build();
+
+ Assert.AreEqual(200, binObj.GetHashCode());
+
+ Assert.AreEqual("str2", binObj.GetField<string>("fStr"));
+ Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNDate"));
+ Assert.AreEqual(nGuid, binObj.GetField<Guid?>("fNGuid"));
+ Assert.AreEqual(TestEnum.Two, binObj.GetField<TestEnum>("fEnum"));
+ Assert.AreEqual(new[] { "str2" }, binObj.GetField<string[]>("fStrArr"));
+ Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
+ Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
+ Assert.AreEqual(new[] { TestEnum.Two }, binObj.GetField<TestEnum[]>("fEnumArr"));
+
+ obj = binObj.Deserialize<StringDateGuidEnum>();
+
+ Assert.AreEqual("str2", obj.FStr);
+ Assert.AreEqual(nDate, obj.FnDate);
+ Assert.AreEqual(nGuid, obj.FnGuid);
+ Assert.AreEqual(TestEnum.Two, obj.FEnum);
+ Assert.AreEqual(new[] { "str2" }, obj.FStrArr);
+ Assert.AreEqual(new[] { nDate }, obj.FDateArr);
+ Assert.AreEqual(new[] { nGuid }, obj.FGuidArr);
+ Assert.AreEqual(new[] { TestEnum.Two }, obj.FEnumArr);
+ }
+
+ /// <summary>
+ /// Test arrays.
+ /// </summary>
+ [Test]
+ public void TestCompositeArray()
+ {
+ // 1. Test simple array.
+ object[] inArr = { new CompositeInner(1) };
+
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
+ .SetField("inArr", inArr).Build();
+
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(CompositeArray).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+
+ var binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(1, binInArr.Length);
+ Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
+
+ CompositeArray arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.OutArr);
+ Assert.AreEqual(1, arr.InArr.Length);
+ Assert.AreEqual(1, ((CompositeInner) arr.InArr[0]).Val);
+
+ // 2. Test addition to array.
+ binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
+ .SetField("inArr", new object[] { binInArr[0], null }).Build();
+
+ Assert.AreEqual(200, binObj.GetHashCode());
+
+ binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(2, binInArr.Length);
+ Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
+ Assert.IsNull(binInArr[1]);
+
+ arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.OutArr);
+ Assert.AreEqual(2, arr.InArr.Length);
+ Assert.AreEqual(1, ((CompositeInner) arr.InArr[0]).Val);
+ Assert.IsNull(arr.InArr[1]);
+
+ binInArr[1] = _grid.GetBinary().GetBuilder(typeof(CompositeInner)).SetField("val", 2).Build();
+
+ binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(300)
+ .SetField("inArr", binInArr.OfType<object>().ToArray()).Build();
+
+ Assert.AreEqual(300, binObj.GetHashCode());
+
+ binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(2, binInArr.Length);
+ Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
+ Assert.AreEqual(2, binInArr[1].GetField<int>("val"));
+
+ arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.OutArr);
+ Assert.AreEqual(2, arr.InArr.Length);
+ Assert.AreEqual(1, ((CompositeInner)arr.InArr[0]).Val);
+ Assert.AreEqual(2, ((CompositeInner)arr.InArr[1]).Val);
+
+ // 3. Test top-level handle inversion.
+ CompositeInner inner = new CompositeInner(1);
+
+ inArr = new object[] { inner, inner };
+
+ binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
+ .SetField("inArr", inArr).Build();
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+
+ binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(2, binInArr.Length);
+ Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
+ Assert.AreEqual(1, binInArr[1].GetField<int>("val"));
+
+ arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.OutArr);
+ Assert.AreEqual(2, arr.InArr.Length);
+ Assert.AreEqual(1, ((CompositeInner)arr.InArr[0]).Val);
+ Assert.AreEqual(1, ((CompositeInner)arr.InArr[1]).Val);
+
+ binInArr[0] = _grid.GetBinary().GetBuilder(typeof(CompositeInner)).SetField("val", 2).Build();
+
+ binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
+ .SetField("inArr", binInArr.ToArray<object>()).Build();
+
+ Assert.AreEqual(200, binObj.GetHashCode());
+
+ binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(2, binInArr.Length);
+ Assert.AreEqual(2, binInArr[0].GetField<int>("val"));
+ Assert.AreEqual(1, binInArr[1].GetField<int>("val"));
+
+ arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.OutArr);
+ Assert.AreEqual(2, arr.InArr.Length);
+ Assert.AreEqual(2, ((CompositeInner)arr.InArr[0]).Val);
+ Assert.AreEqual(1, ((CompositeInner)arr.InArr[1]).Val);
+
+ // 4. Test nested object handle inversion.
+ CompositeOuter[] outArr = { new CompositeOuter(inner), new CompositeOuter(inner) };
+
+ binObj = _grid.GetBinary().GetBuilder(typeof(CompositeArray)).SetHashCode(100)
+ .SetField("outArr", outArr.ToArray<object>()).Build();
+
+ meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(CompositeArray).Name, meta.TypeName);
+ Assert.AreEqual(2, meta.Fields.Count);
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("outArr"));
+
+ Assert.AreEqual(100, binObj.GetHashCode());
+
+ var binOutArr = binObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(2, binOutArr.Length);
+ Assert.AreEqual(1, binOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
+ Assert.AreEqual(1, binOutArr[1].GetField<IBinaryObject>("inner").GetField<int>("val"));
+
+ arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.InArr);
+ Assert.AreEqual(2, arr.OutArr.Length);
+ Assert.AreEqual(1, ((CompositeOuter) arr.OutArr[0]).Inner.Val);
+ Assert.AreEqual(1, ((CompositeOuter) arr.OutArr[0]).Inner.Val);
+
+ binOutArr[0] = _grid.GetBinary().GetBuilder(typeof(CompositeOuter))
+ .SetField("inner", new CompositeInner(2)).Build();
+
+ binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
+ .SetField("outArr", binOutArr.ToArray<object>()).Build();
+
+ Assert.AreEqual(200, binObj.GetHashCode());
+
+ binInArr = binObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
+
+ Assert.AreEqual(2, binInArr.Length);
+ Assert.AreEqual(2, binOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
+ Assert.AreEqual(1, binOutArr[1].GetField<IBinaryObject>("inner").GetField<int>("val"));
+
+ arr = binObj.Deserialize<CompositeArray>();
+
+ Assert.IsNull(arr.InArr);
+ Assert.AreEqual(2, arr.OutArr.Length);
+ Assert.AreEqual(2, ((CompositeOuter)arr.OutArr[0]).Inner.Val);
+ Assert.AreEqual(1, ((CompositeOuter)arr.OutArr[1]).Inner.Val);
+ }
+
+ /// <summary>
+ /// Test container types other than array.
+ /// </summary>
+ [Test]
+ public void TestCompositeContainer()
+ {
+ ArrayList col = new ArrayList();
+ IDictionary dict = new Hashtable();
+
+ col.Add(new CompositeInner(1));
+ dict[3] = new CompositeInner(3);
+
+ IBinaryObject binObj = _grid.GetBinary().GetBuilder(typeof(CompositeContainer)).SetHashCode(100)
+ .SetCollectionField("col", col)
+ .SetDictionaryField("dict", dict).Build();
+
+ // 1. Check meta.
+ IBinaryType meta = binObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(CompositeContainer).Name, meta.TypeName);
+
+ Assert.AreEqual(2, meta.Fields.Count);
+ Assert.AreEqual(BinaryTypeNames.TypeNameCollection, meta.GetFieldTypeName("col"));
+ Assert.AreEqual(BinaryTypeNames.TypeNameMap, meta.GetFieldTypeName("dict"));
+
+ // 2. Check in binary form.
+ Assert.AreEqual(1, binObj.GetField<ICollection>("col").Count);
+ Assert.AreEqual(1, binObj.GetField<ICollection>("col").OfType<IBinaryObject>().First()
+ .GetField<int>("val"));
+
+ Assert.AreEqual(1, binObj.GetField<IDictionary>("dict").Count);
+ Assert.AreEqual(3, ((IBinaryObject) binObj.GetField<IDictionary>("dict")[3]).GetField<int>("val"));
+
+ // 3. Check in deserialized form.
+ CompositeContainer obj = binObj.Deserialize<CompositeContainer>();
+
+ Assert.AreEqual(1, obj.Col.Count);
+ Assert.AreEqual(1, obj.Col.OfType<CompositeInner>().First().Val);
+
+ Assert.AreEqual(1, obj.Dict.Count);
+ Assert.AreEqual(3, ((CompositeInner) obj.Dict[3]).Val);
+ }
+
+ /// <summary>
+ /// Ensure that raw data is not lost during build.
+ /// </summary>
+ [Test]
+ public void TestRawData()
+ {
+ var raw = new WithRaw
+ {
+ A = 1,
+ B = 2
+ };
+
+ var binObj = _marsh.Unmarshal<IBinaryObject>(_marsh.Marshal(raw), BinaryMode.ForceBinary);
+
+ raw = binObj.Deserialize<WithRaw>();
+
+ Assert.AreEqual(1, raw.A);
+ Assert.AreEqual(2, raw.B);
+
+ IBinaryObject newbinObj = _grid.GetBinary().GetBuilder(binObj).SetField("a", 3).Build();
+
+ raw = newbinObj.Deserialize<WithRaw>();
+
+ Assert.AreEqual(3, raw.A);
+ Assert.AreEqual(2, raw.B);
+ }
+
+ /// <summary>
+ /// Test nested objects.
+ /// </summary>
+ [Test]
+ public void TestNested()
+ {
+ // 1. Create from scratch.
+ IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(NestedOuter));
+
+ NestedInner inner1 = new NestedInner {Val = 1};
+ builder.SetField("inner1", inner1);
+
+ IBinaryObject outerbinObj = builder.Build();
+
+ IBinaryType meta = outerbinObj.GetBinaryType();
+
+ Assert.AreEqual(typeof(NestedOuter).Name, meta.TypeName);
+ Assert.AreEqual(1, meta.Fields.Count);
+ Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner1"));
+
+ IBinaryObject innerbinObj1 = outerbinObj.GetField<IBinaryObject>("inner1");
+
+ IBinaryType innerMeta = innerbinObj1.GetBinaryType();
+
+ Assert.AreEqual(typeof(NestedInner).Name, innerMeta.TypeName);
+ Assert.AreEqual(1, innerMeta.Fields.Count);
+ Assert.AreEqual(BinaryTypeNames.TypeNameInt, innerMeta.GetFieldTypeName("Val"));
+
+ inner1 = innerbinObj1.Deserialize<NestedInner>();
+
+ Assert.AreEqual(1, inner1.Val);
+
+ NestedOuter outer = outerbinObj.Deserialize<NestedOuter>();
+ Assert.AreEqual(outer.Inner1.Val, 1);
+ Assert.IsNull(outer.Inner2);
+
+ // 2. Add another field over existing binary object.
+ builder = _grid.GetBinary().GetBuilder(outerbinObj);
+
+ NestedInner inner2 = new NestedInner {Val = 2};
+ builder.SetField("inner2", inner2);
+
+ outerbinObj = builder.Build();
+
+ outer = outerbinObj.Deserialize<NestedOuter>();
+ Assert.AreEqual(1, outer.Inner1.Val);
+ Assert.AreEqual(2, outer.Inner2.Val);
+
+ // 3. Try setting inner object in binary form.
+ innerbinObj1 = _grid.GetBinary().GetBuilder(innerbinObj1).SetField("val", 3).Build();
+
+ inner1 = innerbinObj1.Deserialize<NestedInner>();
+
+ Assert.AreEqual(3, inner1.Val);
+
+ outerbinObj = _grid.GetBinary().GetBuilder(outerbinObj).SetField<object>("inner1", innerbinObj1).Build();
+
+ outer = outerbinObj.Deserialize<NestedOuter>();
+ Assert.AreEqual(3, outer.Inner1.Val);
+ Assert.AreEqual(2, outer.Inner2.Val);
+ }
+
+ /// <summary>
+ /// Test handle migration.
+ /// </summary>
+ [Test]
+ public void TestHandleMigration()
+ {
+ // 1. Simple comparison of results.
+ MigrationInner inner = new MigrationInner {Val = 1};
+
+ MigrationOuter outer = new MigrationOuter
+ {
+ Inner1 = inner,
+ Inner2 = inner
+ };
+
+ byte[] outerBytes = _marsh.Marshal(outer);
+
+ IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(MigrationOuter));
+
+ builder.SetHashCode(outer.GetHashCode());
+
+ builder.SetField<object>("inner1", inner);
+ builder.SetField<object>("inner2", inner);
+
+ BinaryObject portOuter = (BinaryObject) builder.Build();
+
+ byte[] portOuterBytes = new byte[outerBytes.Length];
+
+ Buffer.BlockCopy(portOuter.Data, 0, portOuterBytes, 0, portOuterBytes.Length);
+
+ Assert.AreEqual(outerBytes, portOuterBytes);
+
+ // 2. Change the first inner object so that the handle must migrate.
+ MigrationInner inner1 = new MigrationInner {Val = 2};
+
+ IBinaryObject portOuterMigrated =
+ _grid.GetBinary().GetBuilder(portOuter).SetField<object>("inner1", inner1).Build();
+
+ MigrationOuter outerMigrated = portOuterMigrated.Deserialize<MigrationOuter>();
+
+ Assert.AreEqual(2, outerMigrated.Inner1.Val);
+ Assert.AreEqual(1, outerMigrated.Inner2.Val);
+
+ // 3. Change the first value using serialized form.
+ IBinaryObject inner1Port =
+ _grid.GetBinary().GetBuilder(typeof(MigrationInner)).SetField("val", 2).Build();
+
+ portOuterMigrated =
+ _grid.GetBinary().GetBuilder(portOuter).SetField<object>("inner1", inner1Port).Build();
+
+ outerMigrated = portOuterMigrated.Deserialize<MigrationOuter>();
+
+ Assert.AreEqual(2, outerMigrated.Inner1.Val);
+ Assert.AreEqual(1, outerMigrated.Inner2.Val);
+ }
+
+ /// <summary>
+ /// Test handle inversion.
+ /// </summary>
+ [Test]
+ public void TestHandleInversion()
+ {
+ InversionInner inner = new InversionInner();
+ InversionOuter outer = new InversionOuter();
+
+ inner.Outer = outer;
+ outer.Inner = inner;
+
+ byte[] rawOuter = _marsh.Marshal(outer);
+
+ IBinaryObject portOuter = _marsh.Unmarshal<IBinaryObject>(rawOuter, BinaryMode.ForceBinary);
+ IBinaryObject portInner = portOuter.GetField<IBinaryObject>("inner");
+
+ // 1. Ensure that inner object can be deserialized after build.
+ IBinaryObject portInnerNew = _grid.GetBinary().GetBuilder(portInner).Build();
+
+ InversionInner innerNew = portInnerNew.Deserialize<InversionInner>();
+
+ Assert.AreSame(innerNew, innerNew.Outer.Inner);
+
+ // 2. Ensure that binary object with external dependencies could be added to builder.
+ IBinaryObject portOuterNew =
+ _grid.GetBinary().GetBuilder(typeof(InversionOuter)).SetField<object>("inner", portInner).Build();
+
+ InversionOuter outerNew = portOuterNew.Deserialize<InversionOuter>();
+
+ Assert.AreNotSame(outerNew, outerNew.Inner.Outer);
+ Assert.AreSame(outerNew.Inner, outerNew.Inner.Outer.Inner);
+ }
+
+ /// <summary>
+ /// Test build multiple objects.
+ /// </summary>
+ [Test]
+ public void TestBuildMultiple()
+ {
+ IBinaryObjectBuilder builder = _grid.GetBinary().GetBuilder(typeof(Primitives));
+
+ builder.SetField<byte>("fByte", 1).SetField("fBool", true);
+
+ IBinaryObject po1 = builder.Build();
+ IBinaryObject po2 = builder.Build();
+
+ Assert.AreEqual(1, po1.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po1.GetField<bool>("fBool"));
+
+ Assert.AreEqual(1, po2.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po2.GetField<bool>("fBool"));
+
+ builder.SetField<byte>("fByte", 2);
+
+ IBinaryObject po3 = builder.Build();
+
+ Assert.AreEqual(1, po1.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po1.GetField<bool>("fBool"));
+
+ Assert.AreEqual(1, po2.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po2.GetField<bool>("fBool"));
+
+ Assert.AreEqual(2, po3.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po2.GetField<bool>("fBool"));
+
+ builder = _grid.GetBinary().GetBuilder(po1);
+
+ builder.SetField<byte>("fByte", 10);
+
+ po1 = builder.Build();
+ po2 = builder.Build();
+
+ builder.SetField<byte>("fByte", 20);
+
+ po3 = builder.Build();
+
+ Assert.AreEqual(10, po1.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po1.GetField<bool>("fBool"));
+
+ Assert.AreEqual(10, po2.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po2.GetField<bool>("fBool"));
+
+ Assert.AreEqual(20, po3.GetField<byte>("fByte"));
+ Assert.AreEqual(true, po3.GetField<bool>("fBool"));
+ }
+
+ /// <summary>
+ /// Tests type id method.
+ /// </summary>
+ [Test]
+ public void TestTypeId()
+ {
+ Assert.Throws<ArgumentException>(() => _grid.GetBinary().GetTypeId(null));
+
+ Assert.AreEqual(IdMapper.TestTypeId, _grid.GetBinary().GetTypeId(IdMapper.TestTypeName));
+
+ Assert.AreEqual(BinaryUtils.GetStringHashCode("someTypeName"), _grid.GetBinary().GetTypeId("someTypeName"));
+ }
+
+ /// <summary>
+ /// Tests metadata methods.
+ /// </summary>
+ [Test]
+ public void TestMetadata()
+ {
+ // Populate metadata
+ var binary = _grid.GetBinary();
+
+ binary.ToBinary<IBinaryObject>(new DecimalHolder());
+
+ // All meta
+ var allMetas = binary.GetBinaryTypes();
+
+ var decimalMeta = allMetas.Single(x => x.TypeName == "DecimalHolder");
+
+ Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
+
+ // By type
+ decimalMeta = binary.GetBinaryType(typeof (DecimalHolder));
+
+ Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
+
+ // By type id
+ decimalMeta = binary.GetBinaryType(binary.GetTypeId("DecimalHolder"));
+
+ Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
+
+ // By type name
+ decimalMeta = binary.GetBinaryType("DecimalHolder");
+
+ Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
+ }
+ }
+
+ /// <summary>
+ /// Empty binary class.
+ /// </summary>
+ public class Empty
+ {
+ // No-op.
+ }
+
+ /// <summary>
+ /// binary with primitive fields.
+ /// </summary>
+ public class Primitives
+ {
+ public byte FByte;
+ public bool FBool;
+ public short FShort;
+ public char FChar;
+ public int FInt;
+ public long FLong;
+ public float FFloat;
+ public double FDouble;
+ }
+
+ /// <summary>
+ /// binary with primitive array fields.
+ /// </summary>
+ public class PrimitiveArrays
+ {
+ public byte[] FByte;
+ public bool[] FBool;
+ public short[] FShort;
+ public char[] FChar;
+ public int[] FInt;
+ public long[] FLong;
+ public float[] FFloat;
+ public double[] FDouble;
+ }
+
+ /// <summary>
+ /// binary having strings, dates, Guids and enums.
+ /// </summary>
+ public class StringDateGuidEnum
+ {
+ public string FStr;
+ public DateTime? FnDate;
+ public Guid? FnGuid;
+ public TestEnum FEnum;
+
+ public string[] FStrArr;
+ public DateTime?[] FDateArr;
+ public Guid?[] FGuidArr;
+ public TestEnum[] FEnumArr;
+ }
+
+ /// <summary>
+ /// Enumeration.
+ /// </summary>
+ public enum TestEnum
+ {
+ One, Two
+ }
+
+ /// <summary>
+ /// binary with raw data.
+ /// </summary>
+ public class WithRaw : IBinarizable
+ {
+ public int A;
+ public int B;
+
+ /** <inheritDoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteInt("a", A);
+ writer.GetRawWriter().WriteInt(B);
+ }
+
+ /** <inheritDoc /> */
+ public void ReadBinary(IBinaryReader reader)
+ {
+ A = reader.ReadInt("a");
+ B = reader.GetRawReader().ReadInt();
+ }
+ }
+
+ /// <summary>
+ /// Empty class for metadata overwrite test.
+ /// </summary>
+ public class MetaOverwrite
+ {
+ // No-op.
+ }
+
+ /// <summary>
+ /// Nested outer object.
+ /// </summary>
+ public class NestedOuter
+ {
+ public NestedInner Inner1;
+ public NestedInner Inner2;
+ }
+
+ /// <summary>
+ /// Nested inner object.
+ /// </summary>
+ public class NestedInner
+ {
+ public int Val;
+ }
+
+ /// <summary>
+ /// Outer object for handle migration test.
+ /// </summary>
+ public class MigrationOuter
+ {
+ public MigrationInner Inner1;
+ public MigrationInner Inner2;
+ }
+
+ /// <summary>
+ /// Inner object for handle migration test.
+ /// </summary>
+ public class MigrationInner
+ {
+ public int Val;
+ }
+
+ /// <summary>
+ /// Outer object for handle inversion test.
+ /// </summary>
+ public class InversionOuter
+ {
+ public InversionInner Inner;
+ }
+
+ /// <summary>
+ /// Inner object for handle inversion test.
+ /// </summary>
+ public class InversionInner
+ {
+ public InversionOuter Outer;
+ }
+
+ /// <summary>
+ /// Object for composite array tests.
+ /// </summary>
+ public class CompositeArray
+ {
+ public object[] InArr;
+ public object[] OutArr;
+ }
+
+ /// <summary>
+ /// Object for composite collection/dictionary tests.
+ /// </summary>
+ public class CompositeContainer
+ {
+ public ICollection Col;
+ public IDictionary Dict;
+ }
+
+ /// <summary>
+ /// OUter object for composite structures test.
+ /// </summary>
+ public class CompositeOuter
+ {
+ public CompositeInner Inner;
+
+ public CompositeOuter()
+ {
+ // No-op.
+ }
+
+ public CompositeOuter(CompositeInner inner)
+ {
+ Inner = inner;
+ }
+ }
+
+ /// <summary>
+ /// Inner object for composite structures test.
+ /// </summary>
+ public class CompositeInner
+ {
+ public int Val;
+
+ public CompositeInner()
+ {
+ // No-op.
+ }
+
+ public CompositeInner(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ /// Type to test "ToBinary()" logic.
+ /// </summary>
+ public class ToBinary
+ {
+ public int Val;
+
+ public ToBinary(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ /// Type to test removal.
+ /// </summary>
+ public class Remove
+ {
+ public object Val;
+ public RemoveInner Val2;
+ }
+
+ /// <summary>
+ /// Inner type to test removal.
+ /// </summary>
+ public class RemoveInner
+ {
+ /** */
+ public int Val;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="val"></param>
+ public RemoveInner(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class BuilderInBuilderOuter
+ {
+ /** */
+ public BuilderInBuilderInner Inner;
+
+ /** */
+ public BuilderInBuilderInner Inner2;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class BuilderInBuilderInner
+ {
+ /** */
+ public BuilderInBuilderOuter Outer;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class BuilderCollection
+ {
+ /** */
+ public readonly ArrayList Col;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="col"></param>
+ public BuilderCollection(ArrayList col)
+ {
+ Col = col;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class BuilderCollectionItem
+ {
+ /** */
+ public int Val;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="val"></param>
+ public BuilderCollectionItem(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class DecimalHolder
+ {
+ /** */
+ public decimal Val;
+
+ /** */
+ public decimal?[] ValArr;
+ }
+
+ /// <summary>
+ /// Test id mapper.
+ /// </summary>
+ public class IdMapper : IBinaryIdMapper
+ {
+ /** */
+ public const string TestTypeName = "IdMapperTestType";
+
+ /** */
+ public const int TestTypeId = -65537;
+
+ /** <inheritdoc /> */
+ public int GetTypeId(string typeName)
+ {
+ return typeName == TestTypeName ? TestTypeId : 0;
+ }
+
+ /** <inheritdoc /> */
+ public int GetFieldId(int typeId, string fieldName)
+ {
+ return 0;
+ }
+ }
+}
[05/50] [abbrv] ignite git commit: ignite-1395: Additional fix for
unecessary messages that are printed out by REST module
Posted by vo...@apache.org.
ignite-1395: Additional fix for unecessary messages that are printed out by REST module
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ba2efb7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ba2efb7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ba2efb7
Branch: refs/heads/ignite-1816
Commit: 7ba2efb7cb31ffefa6868f0d7dad3d61993a52c6
Parents: e02b68c
Author: Roman Shtykh <ap...@gmail.com>
Authored: Tue Nov 10 13:17:51 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Nov 10 13:17:51 2015 +0300
----------------------------------------------------------------------
modules/rest-http/pom.xml | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ba2efb7/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 730e28a..9aa79f2 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -116,8 +116,19 @@
<dependency>
<groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
</dependencies>
</project>
[23/50] [abbrv] ignite git commit: ignite-1.5 Added descriptions for
missing options and sort them alphabetically.
Posted by vo...@apache.org.
ignite-1.5 Added descriptions for missing options and sort them alphabetically.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1f5a409c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1f5a409c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1f5a409c
Branch: refs/heads/ignite-1816
Commit: 1f5a409cc138b7df396bcc78ab166b0b366ad7d6
Parents: 55c227a
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Nov 12 10:00:05 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Nov 12 10:00:05 2015 +0700
----------------------------------------------------------------------
modules/yardstick/README.txt | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f5a409c/modules/yardstick/README.txt
----------------------------------------------------------------------
diff --git a/modules/yardstick/README.txt b/modules/yardstick/README.txt
index 8cbe3cf..0b8e678 100644
--- a/modules/yardstick/README.txt
+++ b/modules/yardstick/README.txt
@@ -54,21 +54,23 @@ and command line arguments for running Yardstick scripts.
The following Ignite benchmark properties can be defined in the benchmark configuration:
-* `-nn <num>` or `--nodeNumber <num>` - Number of nodes (automatically set in `benchmark.properties`), used to wait for the specified number of nodes to start
* `-b <num>` or `--backups <num>` - Number of backups for every key
* `-cfg <path>` or `--Config <path>` - Path to Ignite configuration file
-* `-sm <mode>` or `-syncMode <mode>` - Synchronization mode (defined in `CacheWriteSynchronizationMode`)
+* `-cs` or `--cacheStore` - Enable or disable cache store readThrough, writeThrough
* `-cl` or `--client` - Client flag
* `-nc` or `--nearCache` - Near cache flag
-* `-wom <mode>` or `--writeOrderMode <mode>` - Write order mode for ATOMIC caches (defined in `CacheAtomicWriteOrderMode`)
-* `-txc <value>` or `--txConcurrency <value>` - Cache transaction concurrency control, either `OPTIMISTIC` or `PESSIMISTIC` (defined in `CacheTxConcurrency`)
-* `-txi <value>` or `--txIsolation <value>` - Cache transaction isolation (defined in `CacheTxIsolation`)
+* `-nn <num>` or `--nodeNumber <num>` - Number of nodes (automatically set in `benchmark.properties`), used to wait for the specified number of nodes to start
+* `-sm <mode>` or `-syncMode <mode>` - Synchronization mode (defined in `CacheWriteSynchronizationMode`)
* `-ot` or `--offheapTiered` - Flag indicating whether tiered off-heap mode is on
* `-ov` or `--offheapValuesOnly` - Flag indicating whether off-heap mode is on and only cache values are stored off-heap
-* `-rtp <num>` or `--restPort <num>` - REST TCP port, indicates that a Ignite node is ready to process Ignite Clients
+* `-r <num>` or `--range` - Range of keys that are randomly generated for cache operations
* `-rth <host>` or `--restHost <host>` - REST TCP host
+* `-rtp <num>` or `--restPort <num>` - REST TCP port, indicates that a Ignite node is ready to process Ignite Clients
* `-ss` or `--syncSend` - Flag indicating whether synchronous send is used in `TcpCommunicationSpi`
-* `-r <num>` or `--range` - Range of keys that are randomly generated for cache operations
+* `-txc <value>` or `--txConcurrency <value>` - Cache transaction concurrency control, either `OPTIMISTIC` or `PESSIMISTIC` (defined in `CacheTxConcurrency`)
+* `-txi <value>` or `--txIsolation <value>` - Cache transaction isolation (defined in `CacheTxIsolation`)
+* `-wb` or `--writeBehind` - Enable or disable writeBehind for cache store
+* `-wom <mode>` or `--writeOrderMode <mode>` - Write order mode for ATOMIC caches (defined in `CacheAtomicWriteOrderMode`)
For example if we need to run 2 `IgniteNode` servers on localhost with `PutBenchmark` benchmark on localhost,
with number of backups set to 1, synchronization mode set to `PRIMARY_SYNC`, then the following configuration
[34/50] [abbrv] ignite git commit: IGNITE-1910: .Net Fixed leak in
ScanQuery.
Posted by vo...@apache.org.
IGNITE-1910: .Net Fixed leak in ScanQuery.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1de65393
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1de65393
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1de65393
Branch: refs/heads/ignite-1816
Commit: 1de6539322cf8b33eceeb8d1ffdf50ceb398cc89
Parents: c00e4ac
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Tue Nov 17 16:40:35 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 17 16:40:35 2015 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheQueryManager.java | 289 ++++++++++---------
.../Cache/Query/CacheQueriesTest.cs | 17 ++
.../Cache/Store/CacheStoreTest.cs | 35 +++
.../Apache.Ignite.Core/Cache/Query/ScanQuery.cs | 15 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 13 +-
5 files changed, 230 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1de65393/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 58a8424..bef587a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -816,201 +816,218 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
final IgniteBiPredicate<K, V> keyValFilter = qry.scanFilter();
- injectResources(keyValFilter);
+ try {
+ injectResources(keyValFilter);
- final GridDhtCacheAdapter dht = cctx.isLocal() ? null : (cctx.isNear() ? cctx.near().dht() : cctx.dht());
+ final GridDhtCacheAdapter dht = cctx.isLocal() ? null : (cctx.isNear() ? cctx.near().dht() : cctx.dht());
- final GridCacheAdapter cache = dht != null ? dht : cctx.cache();
+ final GridCacheAdapter cache = dht != null ? dht : cctx.cache();
- final ExpiryPolicy plc = cctx.expiry();
+ final ExpiryPolicy plc = cctx.expiry();
- final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
+ final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
- final boolean backups = qry.includeBackups() || cctx.isReplicated();
+ final boolean backups = qry.includeBackups() || cctx.isReplicated();
- final GridCloseableIteratorAdapter<IgniteBiTuple<K, V>> heapIt =
- new GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
- private IgniteBiTuple<K, V> next;
+ final GridCloseableIteratorAdapter<IgniteBiTuple<K, V>> heapIt =
+ new GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
+ private IgniteBiTuple<K, V> next;
- private IgniteCacheExpiryPolicy expiryPlc = cctx.cache().expiryPolicy(plc);
+ private IgniteCacheExpiryPolicy expiryPlc = cctx.cache().expiryPolicy(plc);
- private Iterator<K> iter;
+ private Iterator<K> iter;
- private GridDhtLocalPartition locPart;
+ private GridDhtLocalPartition locPart;
- {
- Integer part = qry.partition();
+ {
+ Integer part = qry.partition();
- if (part == null || dht == null)
- iter = backups ? prj.keySetx().iterator() : prj.primaryKeySet().iterator();
- else if (part < 0 || part >= cctx.affinity().partitions())
- iter = F.emptyIterator();
- else {
- locPart = dht.topology().localPartition(part, topVer, false);
+ if (part == null || dht == null)
+ iter = backups ? prj.keySetx().iterator() : prj.primaryKeySet().iterator();
+ else if (part < 0 || part >= cctx.affinity().partitions())
+ iter = F.emptyIterator();
+ else {
+ locPart = dht.topology().localPartition(part, topVer, false);
- // double check for owning state
- if (locPart == null || locPart.state() != OWNING || !locPart.reserve() ||
- locPart.state() != OWNING)
- throw new GridDhtUnreservedPartitionException(part,
- cctx.affinity().affinityTopologyVersion(), "Partition can not be reserved");
+ // double check for owning state
+ if (locPart == null || locPart.state() != OWNING || !locPart.reserve() ||
+ locPart.state() != OWNING)
+ throw new GridDhtUnreservedPartitionException(part,
+ cctx.affinity().affinityTopologyVersion(), "Partition can not be reserved");
- iter = new Iterator<K>() {
- private Iterator<KeyCacheObject> iter0 = locPart.keySet().iterator();
+ iter = new Iterator<K>() {
+ private Iterator<KeyCacheObject> iter0 = locPart.keySet().iterator();
- @Override public boolean hasNext() {
- return iter0.hasNext();
- }
+ @Override public boolean hasNext() {
+ return iter0.hasNext();
+ }
- @Override public K next() {
- KeyCacheObject key = iter0.next();
+ @Override public K next() {
+ KeyCacheObject key = iter0.next();
- return key.value(cctx.cacheObjectContext(), false);
- }
+ return key.value(cctx.cacheObjectContext(), false);
+ }
- @Override public void remove() {
- iter0.remove();
- }
- };
+ @Override public void remove() {
+ iter0.remove();
+ }
+ };
+ }
+
+ advance();
}
- advance();
- }
+ @Override public boolean onHasNext() {
+ return next != null;
+ }
- @Override public boolean onHasNext() {
- return next != null;
- }
+ @Override public IgniteBiTuple<K, V> onNext() {
+ if (next == null)
+ throw new NoSuchElementException();
- @Override public IgniteBiTuple<K, V> onNext() {
- if (next == null)
- throw new NoSuchElementException();
+ IgniteBiTuple<K, V> next0 = next;
- IgniteBiTuple<K, V> next0 = next;
+ advance();
- advance();
+ return next0;
+ }
- return next0;
- }
+ private void advance() {
+ IgniteBiTuple<K, V> next0 = null;
- private void advance() {
- IgniteBiTuple<K, V> next0 = null;
+ while (iter.hasNext()) {
+ next0 = null;
- while (iter.hasNext()) {
- next0 = null;
+ K key = iter.next();
- K key = iter.next();
+ V val;
- V val;
+ try {
+ GridCacheEntryEx entry = cache.peekEx(key);
- try {
- GridCacheEntryEx entry = cache.peekEx(key);
+ CacheObject cacheVal =
+ entry != null ? entry.peek(true, false, false, topVer, expiryPlc) : null;
- CacheObject cacheVal =
- entry != null ? entry.peek(true, false, false, topVer, expiryPlc) : null;
+ // TODO 950 nocopy
+ val = (V)cctx.cacheObjectContext().unwrapPortableIfNeeded(cacheVal, qry.keepPortable());
+ }
+ catch (GridCacheEntryRemovedException e) {
+ val = null;
+ }
+ catch (IgniteCheckedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to peek value: " + e);
- // TODO 950 nocopy
- val = (V)cctx.cacheObjectContext().unwrapPortableIfNeeded(cacheVal, qry.keepPortable());
- }
- catch (GridCacheEntryRemovedException e) {
- val = null;
- }
- catch (IgniteCheckedException e) {
- if (log.isDebugEnabled())
- log.debug("Failed to peek value: " + e);
+ val = null;
+ }
- val = null;
- }
+ if (dht != null && expiryPlc != null && expiryPlc.readyToFlush(100)) {
+ dht.sendTtlUpdateRequest(expiryPlc);
- if (dht != null && expiryPlc != null && expiryPlc.readyToFlush(100)) {
- dht.sendTtlUpdateRequest(expiryPlc);
+ expiryPlc = cctx.cache().expiryPolicy(plc);
+ }
- expiryPlc = cctx.cache().expiryPolicy(plc);
+ if (val != null) {
+ next0 = F.t(key, val);
+
+ if (checkPredicate(next0))
+ break;
+ else
+ next0 = null;
+ }
}
- if (val != null) {
- next0 = F.t(key, val);
+ next = next0 != null ?
+ new IgniteBiTuple<>(next0.getKey(), next0.getValue()) :
+ null;
- if (checkPredicate(next0))
- break;
- else
- next0 = null;
- }
+ if (next == null)
+ sendTtlUpdate();
}
- next = next0 != null ?
- new IgniteBiTuple<>(next0.getKey(), next0.getValue()) :
- null;
-
- if (next == null)
+ @Override protected void onClose() {
sendTtlUpdate();
- }
- @Override protected void onClose() {
- sendTtlUpdate();
-
- if (locPart != null)
- locPart.release();
- }
-
- private void sendTtlUpdate() {
- if (dht != null && expiryPlc != null) {
- dht.sendTtlUpdateRequest(expiryPlc);
-
- expiryPlc = null;
+ if (locPart != null)
+ locPart.release();
}
- }
- private boolean checkPredicate(Map.Entry<K, V> e) {
- if (keyValFilter != null) {
- Map.Entry<K, V> e0 = (Map.Entry<K, V>)cctx.unwrapPortableIfNeeded(e, qry.keepPortable());
+ private void sendTtlUpdate() {
+ if (dht != null && expiryPlc != null) {
+ dht.sendTtlUpdateRequest(expiryPlc);
- return keyValFilter.apply(e0.getKey(), e0.getValue());
+ expiryPlc = null;
+ }
}
- return true;
- }
- };
+ private boolean checkPredicate(Map.Entry<K, V> e) {
+ if (keyValFilter != null) {
+ Map.Entry<K, V> e0 = (Map.Entry<K, V>)cctx.unwrapPortableIfNeeded(e, qry.keepPortable());
- final GridIterator<IgniteBiTuple<K, V>> it;
+ return keyValFilter.apply(e0.getKey(), e0.getValue());
+ }
- if (cctx.isSwapOrOffheapEnabled()) {
- List<GridIterator<IgniteBiTuple<K, V>>> iters = new ArrayList<>(3);
+ return true;
+ }
+ };
- iters.add(heapIt);
+ final GridIterator<IgniteBiTuple<K, V>> it;
- if (cctx.isOffHeapEnabled())
- iters.add(offheapIterator(qry, backups));
+ if (cctx.isSwapOrOffheapEnabled()) {
+ List<GridIterator<IgniteBiTuple<K, V>>> iters = new ArrayList<>(3);
- if (cctx.swap().swapEnabled())
- iters.add(swapIterator(qry, backups));
+ iters.add(heapIt);
- it = new CompoundIterator<>(iters);
- }
- else
- it = heapIt;
+ if (cctx.isOffHeapEnabled())
+ iters.add(offheapIterator(qry, backups));
- return new GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
- @Override protected boolean onHasNext() {
- return it.hasNext();
- }
+ if (cctx.swap().swapEnabled())
+ iters.add(swapIterator(qry, backups));
- @Override protected IgniteBiTuple<K, V> onNext() {
- return it.next();
+ it = new CompoundIterator<>(iters);
}
+ else
+ it = heapIt;
- @Override protected void onRemove() {
- it.remove();
- }
+ return new GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
+ @Override protected boolean onHasNext() {
+ return it.hasNext();
+ }
- @Override protected void onClose() throws IgniteCheckedException {
- try {
- heapIt.close();
+ @Override protected IgniteBiTuple<K, V> onNext() {
+ return it.next();
}
- finally {
- if (keyValFilter instanceof PlatformCacheEntryFilter)
- ((PlatformCacheEntryFilter)keyValFilter).onClose();
+
+ @Override protected void onRemove() {
+ it.remove();
}
- }
- };
+
+ @Override protected void onClose() throws IgniteCheckedException {
+ try {
+ heapIt.close();
+ }
+ finally {
+ closeScanFilter(keyValFilter);
+ }
+ }
+ };
+ }
+ catch (IgniteCheckedException | RuntimeException e)
+ {
+ closeScanFilter(keyValFilter);
+
+ throw e;
+ }
+ }
+
+ /**
+ * Closes a filter if it is closeable.
+ *
+ * @param f Filter.
+ */
+ private static void closeScanFilter(Object f) {
+ if (f instanceof PlatformCacheEntryFilter)
+ ((PlatformCacheEntryFilter)f).onClose();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/1de65393/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index 7c7fe35..74c4801 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+ using System.Linq;
using System.Text;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
@@ -115,6 +116,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Assert.IsTrue(cache.IsEmpty());
}
+ TestUtils.AssertHandleRegistryIsEmpty(300,
+ Enumerable.Range(0, GridCnt).Select(x => Ignition.GetIgnite("grid-" + x)).ToArray());
+
Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
}
@@ -625,6 +629,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
qry = new ScanQuery<int, TV>(new PortableScanQueryFilter<TV>());
ValidateQueryResults(cache, qry, exp, keepPortable);
+ // Invalid
+ exp = PopulateCache(cache, loc, cnt, x => x < 50);
+ qry = new ScanQuery<int, TV>(new InvalidScanQueryFilter<TV>());
+ Assert.Throws<BinaryObjectException>(() => ValidateQueryResults(cache, qry, exp, keepPortable));
+
// Exception
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV> {ThrowErr = true});
@@ -917,4 +926,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
ThrowErr = r.ReadBoolean();
}
}
+
+ /// <summary>
+ /// Filter that can't be serialized.
+ /// </summary>
+ public class InvalidScanQueryFilter<TV> : ScanQueryFilter<TV>
+ {
+ // No-op.
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1de65393/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index 0dc9912..eb148f0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using System.Collections.Generic;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
+ using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Impl;
using NUnit.Framework;
@@ -90,6 +91,27 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
/// <summary>
+ /// Cache entry predicate that throws an exception.
+ /// </summary>
+ [Serializable]
+ public class ExceptionalEntryFilter : ICacheEntryFilter<int, string>
+ {
+ /** <inheritdoc /> */
+ public bool Invoke(ICacheEntry<int, string> entry)
+ {
+ throw new Exception("Expected exception in ExceptionalEntryFilter");
+ }
+ }
+
+ /// <summary>
+ /// Filter that can't be serialized.
+ /// </summary>
+ public class InvalidCacheEntryFilter : CacheEntryFilter
+ {
+ // No-op.
+ }
+
+ /// <summary>
///
/// </summary>
public class CacheStoreTest
@@ -106,6 +128,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/** */
private const string TemplateStoreCacheName = "template_store*";
+ /** */
+ private volatile int _storeCount = 3;
+
/// <summary>
///
/// </summary>
@@ -166,6 +191,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
CacheTestStore.Reset();
+ TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName()));
+
Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
}
@@ -182,6 +209,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
for (int i = 105; i < 110; i++)
Assert.AreEqual("val_" + i, cache.Get(i));
+
+ // Test invalid filter
+ Assert.Throws<BinaryObjectException>(() => cache.LoadCache(new InvalidCacheEntryFilter(), 100, 10));
+
+ // Test exception in filter
+ Assert.Throws<CacheStoreException>(() => cache.LoadCache(new ExceptionalEntryFilter(), 100, 10));
}
[Test]
@@ -443,6 +476,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.Put(1, cache.Name);
Assert.AreEqual(cache.Name, CacheTestStore.Map[1]);
+
+ _storeCount++;
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/1de65393/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
index e1478f3..12fb363 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
@@ -17,6 +17,7 @@
namespace Apache.Ignite.Core.Cache.Query
{
+ using System;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache;
@@ -62,8 +63,18 @@ namespace Apache.Ignite.Core.Cache.Query
{
var holder = new CacheEntryFilterHolder(Filter, (key, val) => Filter.Invoke(
new CacheEntry<TK, TV>((TK) key, (TV) val)), writer.Marshaller, keepBinary);
-
- writer.WriteObject(holder);
+
+ try
+ {
+ writer.WriteObject(holder);
+ }
+ catch (Exception)
+ {
+ writer.Marshaller.Ignite.HandleRegistry.Release(holder.Handle);
+
+ throw;
+ }
+
writer.WriteLong(holder.Handle);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1de65393/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index a6dfe7e..b1870d7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -272,7 +272,18 @@ namespace Apache.Ignite.Core.Impl.Cache
{
var p0 = new CacheEntryFilterHolder(p, (k, v) => p.Invoke(new CacheEntry<TK, TV>((TK)k, (TV)v)),
Marshaller, IsKeepBinary);
- writer.WriteObject(p0);
+
+ try
+ {
+ writer.WriteObject(p0);
+ }
+ catch (Exception)
+ {
+ writer.Marshaller.Ignite.HandleRegistry.Release(p0.Handle);
+
+ throw;
+ }
+
writer.WriteLong(p0.Handle);
}
else
[30/50] [abbrv] ignite git commit: Merge branch ignite-1.5 into
ignite-1282
Posted by vo...@apache.org.
Merge branch ignite-1.5 into ignite-1282
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0ccba79f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0ccba79f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0ccba79f
Branch: refs/heads/ignite-1816
Commit: 0ccba79f9109d1e2042581b45e72d9dedeef9d9a
Parents: 25292c7 d54fcbe
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Nov 17 13:35:12 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 17 13:35:12 2015 +0300
----------------------------------------------------------------------
.../rest/AbstractRestProcessorSelfTest.java | 5 +-
.../JettyRestProcessorAbstractSelfTest.java | 142 +-
.../java/org/apache/ignite/IgniteCache.java | 3 +-
.../eviction/random/RandomEvictionPolicy.java | 4 +
.../cache/store/CacheStoreSessionListener.java | 9 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 34 +-
.../jdbc/CacheJdbcStoreSessionListener.java | 8 +-
.../configuration/CacheConfiguration.java | 95 +-
.../configuration/ConnectorConfiguration.java | 61 +-
.../configuration/IgniteConfiguration.java | 32 +-
.../apache/ignite/internal/IgniteKernal.java | 21 +
.../org/apache/ignite/internal/IgnitionEx.java | 3 +
.../managers/communication/GridIoMessage.java | 4 +-
.../communication/GridIoMessageFactory.java | 10 +-
.../discovery/GridDiscoveryManager.java | 5 +-
.../cache/CacheStoreBalancingWrapper.java | 5 +-
.../processors/cache/GridCacheAdapter.java | 22 +-
.../processors/cache/GridCacheContext.java | 29 +-
.../processors/cache/GridCacheEntryEx.java | 4 +-
.../processors/cache/GridCacheIoManager.java | 19 +-
.../processors/cache/GridCacheMapEntry.java | 91 +-
.../processors/cache/GridCacheMvccManager.java | 145 +-
.../GridCachePartitionExchangeManager.java | 184 ++-
.../processors/cache/GridCachePreloader.java | 55 +-
.../cache/GridCachePreloaderAdapter.java | 40 +-
.../processors/cache/GridCacheProcessor.java | 55 +-
.../processors/cache/IgniteCacheProxy.java | 6 +
.../distributed/GridDistributedCacheEntry.java | 2 +-
.../distributed/GridDistributedTxMapping.java | 8 +-
.../GridDistributedTxRemoteAdapter.java | 5 +-
.../distributed/dht/GridDhtCacheEntry.java | 11 +-
.../distributed/dht/GridDhtLocalPartition.java | 63 +-
.../distributed/dht/GridDhtLockFuture.java | 7 +-
.../dht/GridDhtPartitionsReservation.java | 2 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 12 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 39 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 78 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 33 +-
.../dht/colocated/GridDhtColocatedCache.java | 7 +-
.../GridDhtPartitionDemandMessage.java | 14 +-
.../preloader/GridDhtPartitionDemandPool.java | 1192 ---------------
.../dht/preloader/GridDhtPartitionDemander.java | 1408 ++++++++++++++++++
.../dht/preloader/GridDhtPartitionSupplier.java | 1037 +++++++++++++
.../GridDhtPartitionSupplyMessageV2.java | 380 +++++
.../preloader/GridDhtPartitionSupplyPool.java | 555 -------
.../GridDhtPartitionsExchangeFuture.java | 2 +
.../dht/preloader/GridDhtPreloader.java | 282 +++-
.../near/GridNearOptimisticTxPrepareFuture.java | 11 +-
.../near/GridNearTransactionalCache.java | 7 +-
.../near/GridNearTxFinishFuture.java | 157 +-
.../cache/distributed/near/GridNearTxLocal.java | 21 +-
.../store/GridCacheStoreManagerAdapter.java | 29 +-
.../cache/transactions/IgniteInternalTx.java | 3 +-
.../cache/transactions/IgniteTxAdapter.java | 251 ++--
.../cache/transactions/IgniteTxHandler.java | 37 +-
.../transactions/IgniteTxLocalAdapter.java | 22 +-
.../cache/transactions/IgniteTxManager.java | 171 ++-
.../datastructures/DataStructuresProcessor.java | 3 +
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../handlers/cache/GridCacheCommandHandler.java | 128 +-
.../handlers/query/QueryCommandHandler.java | 254 +++-
.../top/GridTopologyCommandHandler.java | 4 -
.../processors/task/GridTaskWorker.java | 4 +-
.../GridBoundedConcurrentLinkedHashMap.java | 7 +-
.../GridBoundedConcurrentLinkedHashSet.java | 7 +-
.../util/GridBoundedConcurrentOrderedMap.java | 39 +-
.../internal/util/GridConcurrentFactory.java | 11 +-
.../util/GridConcurrentLinkedHashSet.java | 9 +-
.../ignite/internal/util/IgniteUuidCache.java | 6 +-
.../util/future/GridCompoundFuture.java | 155 +-
.../ignite/internal/util/lang/GridTuple4.java | 2 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 360 +++--
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 4 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 95 +-
.../messages/TcpDiscoveryAbstractMessage.java | 37 +
.../TcpDiscoveryStatusCheckMessage.java | 11 +
.../java/org/jsr166/ConcurrentHashMap8.java | 2 +-
.../java/org/jsr166/ConcurrentLinkedDeque8.java | 2 +-
.../org/jsr166/ConcurrentLinkedHashMap.java | 195 ++-
.../GridCacheAffinityBackupsSelfTest.java | 8 +
.../store/GridCacheBalancingStoreSelfTest.java | 220 ++-
.../GridCacheLoadOnlyStoreAdapterSelfTest.java | 145 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
.../GridCacheMissingCommitVersionSelfTest.java | 40 +-
.../processors/cache/GridCacheTestEntryEx.java | 3 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 2 +-
...CacheAtomicReferenceApiSelfAbstractTest.java | 20 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 21 +-
...gniteCachePutRetryTransactionalSelfTest.java | 10 +
...achePartitionedMultiNodeFullApiSelfTest.java | 2 +-
.../GridCacheRebalancingAsyncSelfTest.java | 68 +
.../GridCacheRebalancingSyncSelfTest.java | 506 +++++++
...eRebalancingUnmarshallingFailedSelfTest.java | 147 ++
.../GridCacheReplicatedPreloadSelfTest.java | 22 +-
.../continuous/GridEventConsumeSelfTest.java | 2 +-
...dBoundedConcurrentLinkedHashMapSelfTest.java | 2 +-
.../GridConcurrentLinkedHashMapSelfTest.java | 62 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 158 +-
.../discovery/tcp/TcpDiscoveryRestartTest.java | 10 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 476 +++++-
.../spi/discovery/tcp/TestTcpDiscoverySpi.java | 46 +
.../TcpDiscoveryMulticastIpFinderSelfTest.java | 28 +-
.../testframework/junits/GridAbstractTest.java | 32 +-
.../junits/common/GridCommonAbstractTest.java | 25 +-
.../testsuites/IgniteCacheTestSuite3.java | 4 +
...rrentLinkedHashMapMultiThreadedSelfTest.java | 104 +-
.../tcp/GridOrderedMessageCancelSelfTest.java | 18 +-
modules/rest-http/pom.xml | 11 +
.../visor/commands/open/VisorOpenCommand.scala | 14 +-
.../scala/org/apache/ignite/visor/visor.scala | 3 +-
modules/yardstick/README.txt | 16 +-
.../config/benchmark-multicast.properties | 9 +-
.../yardstick/config/benchmark-store.properties | 86 +-
.../yardstick/config/ignite-store-config.xml | 31 +-
.../yardstick/IgniteBenchmarkArguments.java | 2 +-
.../ignite/yardstick/IgniteBenchmarkUtils.java | 75 +
.../org/apache/ignite/yardstick/IgniteNode.java | 23 +-
.../IgniteAccountSerializableTxBenchmark.java | 11 +-
.../cache/IgniteAccountTxBenchmark.java | 11 +-
.../cache/IgniteGetAllPutAllTxBenchmark.java | 73 +
.../cache/IgnitePutGetTxBenchmark.java | 41 +-
.../yardstick/cache/IgnitePutTxBenchmark.java | 10 +
.../cache/IgnitePutTxPrimaryOnlyBenchmark.java | 65 +
.../IgnitePutTxSkipLocalBackupBenchmark.java | 65 +
.../cache/WaitMapExchangeFinishCallable.java | 95 ++
...IgniteTransactionalWriteInvokeBenchmark.java | 41 +-
.../IgniteTransactionalWriteReadBenchmark.java | 41 +-
modules/zookeeper/pom.xml | 2 +-
130 files changed, 7772 insertions(+), 3414 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index af0122f,1b8d41c..9cde3a2
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@@ -202,9 -174,8 +206,12 @@@ public class CacheConfiguration<K, V> e
/** 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);
++ public static final Boolean DFLT_KEEP_PORTABLE_IN_STORE = new Boolean(true);
++
+ /** Default threshold for concurrent loading of keys from {@link CacheStore}. */
+ public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5;
/** Cache name. */
private String name;
@@@ -438,16 -408,15 +452,17 @@@
name = cc.getName();
nearCfg = cc.getNearConfiguration();
nodeFilter = cc.getNodeFilter();
- rebalanceBatchesPrefetchCount = cc.getRebalanceBatchesPrefetchCount();
+ pluginCfgs = cc.getPluginConfigurations();
+ qryEntities = cc.getQueryEntities();
- rebalanceMode = cc.getRebalanceMode();
++ readFromBackup = cc.isReadFromBackup();
rebalanceBatchSize = cc.getRebalanceBatchSize();
++ rebalanceBatchesPrefetchCount = cc.getRebalanceBatchesPrefetchCount();
rebalanceDelay = cc.getRebalanceDelay();
+ rebalanceMode = cc.getRebalanceMode();
rebalanceOrder = cc.getRebalanceOrder();
rebalancePoolSize = cc.getRebalanceThreadPoolSize();
rebalanceTimeout = cc.getRebalanceTimeout();
rebalanceThrottle = cc.getRebalanceThrottle();
-- readFromBackup = cc.isReadFromBackup();
sqlEscapeAll = cc.isSqlEscapeAll();
sqlFuncCls = cc.getSqlFunctionClasses();
sqlOnheapRowCacheSize = cc.getSqlOnheapRowCacheSize();
@@@ -870,38 -840,37 +885,69 @@@
}
/**
+ * 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 binary will be deserialized when
+ * store is called.
+ *
+ * @return Keep binary in store flag.
+ */
+ public Boolean isKeepPortableInStore() {
+ return keepPortableInStore;
+ }
+
+ /**
+ * Sets keep binary in store flag.
+ *
+ * @param keepPortableInStore Keep binary in store flag.
+ */
+ public void setKeepPortableInStore(boolean keepPortableInStore) {
+ this.keepPortableInStore = keepPortableInStore;
+ }
+
+ /**
+ * Gets the threshold used in cases when values for multiple keys are being loaded from an underlying
+ * {@link CacheStore} in parallel. In the situation when several threads load the same or intersecting set of keys
+ * and the total number of keys to load is less or equal to this threshold then there will be no a second call to
+ * the storage in order to load a key from thread A if the same key is already being loaded by thread B.
+ *
+ * The threshold should be controlled wisely. On the one hand if it's set to a big value then the interaction with
+ * a storage during the load of missing keys will be minimal. On the other hand the big value may result in
+ * significant performance degradation because it is needed to check for every key whether it's being loaded or not.
+ *
+ * When not set, default value is {@link #DFLT_CONCURRENT_LOAD_ALL_THRESHOLD}.
+ *
+ * @return The concurrent load-all threshold.
+ */
+ public int getStoreConcurrentLoadAllThreshold() {
+ return storeConcurrentLoadAllThreshold;
+ }
+
+ /**
+ * Sets the concurrent load-all threshold used for cases when keys' values are being loaded from {@link CacheStore}
+ * in parallel.
+ *
+ * @param storeConcurrentLoadAllThreshold The concurrent load-all threshold.
+ * @return {@code this} for chaining.
+ */
+ public CacheConfiguration<K, V> setStoreConcurrentLoadAllThreshold(int storeConcurrentLoadAllThreshold) {
+ this.storeConcurrentLoadAllThreshold = storeConcurrentLoadAllThreshold;
+
+ return this;
+ }
+
+ /**
* Gets key topology resolver to provide mapping from keys to nodes.
*
* @return Key topology resolver to provide mapping from keys to nodes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index a91aa7e,9298c6d..2069a90
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@@ -506,9 -504,9 +512,10 @@@ public class IgniteConfiguration
p2pLocClsPathExcl = cfg.getPeerClassLoadingLocalClassPathExclude();
p2pMissedCacheSize = cfg.getPeerClassLoadingMissedResourcesCacheSize();
p2pPoolSize = cfg.getPeerClassLoadingThreadPoolSize();
+ platformCfg = cfg.getPlatformConfiguration();
pluginCfgs = cfg.getPluginConfigurations();
pubPoolSize = cfg.getPublicThreadPoolSize();
+ rebalanceThreadPoolSize = cfg.getRebalanceThreadPoolSize();
segChkFreq = cfg.getSegmentCheckFrequency();
segPlc = cfg.getSegmentationPolicy();
segResolveAttempts = cfg.getSegmentationResolveAttempts();
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index a5762ad,df9f5c4..5ced545
--- 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
@@@ -1135,9 -1106,10 +1135,10 @@@ public abstract class GridCacheMapEntr
if (intercept) {
val0 = CU.value(val, cctx, false);
- CacheLazyEntry e = new CacheLazyEntry(cctx, key, old);
+ CacheLazyEntry e = new CacheLazyEntry(cctx, key, old, keepPortable);
- Object interceptorVal = cctx.config().getInterceptor().onBeforePut(new CacheLazyEntry(cctx, key, old, keepPortable),
+ Object interceptorVal = cctx.config().getInterceptor().onBeforePut(
- new CacheLazyEntry(cctx, key, old),
++ new CacheLazyEntry(cctx, key, old, keepPortable),
val0);
key0 = e.key();
@@@ -1380,41 -1352,34 +1384,34 @@@
if (cctx.isLocal() || cctx.isReplicated() || (tx != null && tx.local() && !isNear()))
cctx.continuousQueries().onEntryUpdated(this, key, null, old, false);
- cctx.dataStructures().onEntryUpdated(key, true);
+ cctx.dataStructures().onEntryUpdated(key, true, keepPortable);
- }
-
- // Persist outside of synchronization. The correctness of the
- // value will be handled by current transaction.
- if (writeThrough)
- cctx.store().remove(tx, keyValue(false));
- if (cctx.deferredDelete() && !detached() && !isInternal())
- cctx.onDeferredDelete(this, newVer);
- else {
- boolean marked = false;
+ deferred = cctx.deferredDelete() && !detached() && !isInternal();
- synchronized (this) {
+ if (!deferred) {
// If entry is still removed.
- if (newVer == ver) {
- if (obsoleteVer == null || !(marked = markObsolete0(obsoleteVer, true))) {
- if (log.isDebugEnabled())
- log.debug("Entry could not be marked obsolete (it is still used): " + this);
- }
- else {
- recordNodeId(affNodeId, topVer);
+ assert newVer == ver;
- // If entry was not marked obsolete, then removed lock
- // will be registered whenever removeLock is called.
- cctx.mvcc().addRemoved(cctx, obsoleteVer);
+ if (obsoleteVer == null || !(marked = markObsolete0(obsoleteVer, true, null))) {
+ if (log.isDebugEnabled())
+ log.debug("Entry could not be marked obsolete (it is still used): " + this);
+ }
+ else {
+ recordNodeId(affNodeId, topVer);
- if (log.isDebugEnabled())
- log.debug("Entry was marked obsolete: " + this);
- }
+ if (log.isDebugEnabled())
+ log.debug("Entry was marked obsolete: " + this);
}
}
+ }
- if (marked)
- onMarkedObsolete();
+ if (deferred)
+ cctx.onDeferredDelete(this, newVer);
+
+ if (marked) {
+ assert !deferred;
+
+ onMarkedObsolete();
}
if (intercept)
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index 3aa7e1c,93303c8..29f67ce
--- 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
@@@ -583,10 -583,8 +583,9 @@@ public class GridDistributedTxRemoteAda
eventNodeId(),
nodeId,
false,
- false,
true,
true,
+ txEntry.keepBinary(),
topVer,
null,
replicate ? DR_BACKUP : DR_NONE,
@@@ -631,10 -629,8 +631,9 @@@
eventNodeId(),
nodeId,
false,
- false,
true,
true,
+ txEntry.keepBinary(),
topVer,
null,
replicate ? DR_BACKUP : DR_NONE,
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/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/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
index ad8a402,e268a88..ca677b2
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
@@@ -183,19 -184,19 +184,19 @@@ public class GridDhtTxRemote extends Gr
int taskNameHash
) {
super(
- ctx,
- nodeId,
- rmtThreadId,
- xidVer,
- commitVer,
+ ctx,
+ nodeId,
+ rmtThreadId,
+ xidVer,
+ commitVer,
sys,
plc,
- concurrency,
- isolation,
- invalidate,
+ concurrency,
+ isolation,
+ invalidate,
timeout,
txSize,
- subjId,
+ subjId,
taskNameHash
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 214ba45,2c7bf8a..9f52699
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@@ -1062,10 -1054,8 +1062,9 @@@ public abstract class IgniteTxLocalAdap
eventNodeId(),
txEntry.nodeId(),
false,
- false,
evt,
metrics,
+ txEntry.keepBinary(),
topVer,
null,
cached.detached() ? DR_NONE : drType,
@@@ -1080,10 -1070,8 +1079,9 @@@
eventNodeId(),
nodeId,
false,
- false,
false,
metrics,
+ txEntry.keepBinary(),
topVer,
CU.empty0(),
DR_NONE,
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccba79f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
----------------------------------------------------------------------
[10/50] [abbrv] ignite git commit: Ignite-1093 Logging fixes.
Posted by vo...@apache.org.
Ignite-1093 Logging fixes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2b6fc494
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2b6fc494
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2b6fc494
Branch: refs/heads/ignite-1816
Commit: 2b6fc4942f126ed42bb6c89ed20f5a9b4b37f655
Parents: 67f8858
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 10 16:54:48 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 10 16:54:48 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCachePartitionExchangeManager.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b6fc494/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 5b4fee3..81ff028 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -1357,7 +1357,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (futQ.isEmpty()) {
U.log(log, "Rebalancing required" +
"[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
- ", node=" + exchFut.discoveryEvent().node().id() + ']');
+ ", node=" + exchFut.discoveryEvent().eventNode().id() + ']');
if (marshR != null)
try {
@@ -1402,12 +1402,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
else
U.log(log, "Skipping rebalancing (obsolete exchange ID) " +
"[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
- ", node=" + exchFut.discoveryEvent().node().id() + ']');
+ ", node=" + exchFut.discoveryEvent().eventNode().id() + ']');
}
else
U.log(log, "Skipping rebalancing (nothing scheduled) " +
"[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
- ", node=" + exchFut.discoveryEvent().node().id() + ']');
+ ", node=" + exchFut.discoveryEvent().eventNode().id() + ']');
}
}
catch (IgniteInterruptedCheckedException e) {
[11/50] [abbrv] ignite git commit: IGNITE-1868
Posted by vo...@apache.org.
IGNITE-1868
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/77ee0654
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/77ee0654
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/77ee0654
Branch: refs/heads/ignite-1816
Commit: 77ee0654b0d3b15368a94782339ec9db4cad959d
Parents: 2b6fc49
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 10 17:50:35 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 10 17:50:35 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/processors/igfs/IgfsMetaManager.java | 2 +-
.../core/src/main/java/org/apache/ignite/stream/StreamAdapter.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/77ee0654/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index e75fe51..ab73e7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -990,7 +990,7 @@ public class IgfsMetaManager extends IgfsManager {
* @param expIds Expected IDs for this path. Might contain additional elements, e.g. because they were created
* on a child path.
* @param infos Locked infos.
- * @return
+ * @return verification result.
*/
private static boolean verifyPathIntegrity(IgfsPath path, List<IgniteUuid> expIds,
Map<IgniteUuid, IgfsFileInfo> infos) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/77ee0654/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
index e7d224c..2cb7db7 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
@@ -33,7 +33,7 @@ import org.apache.ignite.IgniteDataStreamer;
* <li>A single tuple extractor, which extracts either no or 1 tuple out of a message. See
* see {@link #setTupleExtractor(StreamTupleExtractor)}.</li>
* <li>A multiple tuple extractor, which is capable of extracting multiple tuples out of a single message, in the
- * form of a {@link Map<K, V>}. See {@link #setMultipleTupleExtractor(StreamMultipleTupleExtractor)}.</li>
+ * form of a {@link Map}. See {@link #setMultipleTupleExtractor(StreamMultipleTupleExtractor)}.</li>
* </ol>
*/
public abstract class StreamAdapter<T, K, V> {
[40/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index cb582b7..68616ab 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -39,8 +39,8 @@ namespace Apache.Ignite.Core.Tests.Compute
/** Echo task name. */
private const string EchoTask = "org.apache.ignite.platform.PlatformComputeEchoTask";
- /** Portable argument task name. */
- private const string PortableArgTask = "org.apache.ignite.platform.PlatformComputePortableArgTask";
+ /** Binary argument task name. */
+ private const string BinaryArgTask = "org.apache.ignite.platform.PlatformComputeBinarizableArgTask";
/** Broadcast task name. */
private const string BroadcastTask = "org.apache.ignite.platform.PlatformComputeBroadcastTask";
@@ -48,8 +48,8 @@ namespace Apache.Ignite.Core.Tests.Compute
/** Broadcast task name. */
private const string DecimalTask = "org.apache.ignite.platform.PlatformComputeDecimalTask";
- /** Java portable class name. */
- private const string JavaPortableCls = "GridInteropComputeJavaPortable";
+ /** Java binary class name. */
+ private const string JavaBinaryCls = "PlatformComputeJavaBinarizable";
/** Echo type: null. */
private const int EchoTypeNull = 0;
@@ -87,17 +87,17 @@ namespace Apache.Ignite.Core.Tests.Compute
/** Echo type: map. */
private const int EchoTypeMap = 11;
- /** Echo type: portable. */
- private const int EchoTypePortable = 12;
+ /** Echo type: binarizable. */
+ private const int EchoTypeBinarizable = 12;
- /** Echo type: portable (Java only). */
- private const int EchoTypePortableJava = 13;
+ /** Echo type: binary (Java only). */
+ private const int EchoTypeBinarizableJava = 13;
/** Type: object array. */
private const int EchoTypeObjArray = 14;
- /** Type: portable object array. */
- private const int EchoTypePortableArray = 15;
+ /** Type: binary object array. */
+ private const int EchoTypeBinarizableArray = 15;
/** Type: enum. */
private const int EchoTypeEnum = 16;
@@ -799,34 +799,34 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Test echo task returning portable object.
+ /// Test echo task returning binary object.
/// </summary>
[Test]
- public void TestEchoTaskPortable()
+ public void TestEchoTaskBinarizable()
{
- PlatformComputePortable res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputePortable>(EchoTask, EchoTypePortable);
+ var res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(EchoTask, EchoTypeBinarizable);
Assert.AreEqual(1, res.Field);
}
/// <summary>
- /// Test echo task returning portable object with no corresponding class definition.
+ /// Test echo task returning binary object with no corresponding class definition.
/// </summary>
[Test]
- public void TestEchoTaskPortableNoClass()
+ public void TestEchoTaskBinarizableNoClass()
{
ICompute compute = _grid1.GetCompute();
compute.WithKeepBinary();
- IBinaryObject res = compute.ExecuteJavaTask<IBinaryObject>(EchoTask, EchoTypePortableJava);
+ IBinaryObject res = compute.ExecuteJavaTask<IBinaryObject>(EchoTask, EchoTypeBinarizableJava);
Assert.AreEqual(1, res.GetField<int>("field"));
- // This call must fail because "keepPortable" flag is reset.
+ // This call must fail because "keepBinary" flag is reset.
Assert.Catch(typeof(BinaryObjectException), () =>
{
- compute.ExecuteJavaTask<IBinaryObject>(EchoTask, EchoTypePortableJava);
+ compute.ExecuteJavaTask<IBinaryObject>(EchoTask, EchoTypeBinarizableJava);
});
}
@@ -842,17 +842,17 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Tests the echo task returning portable array.
+ /// Tests the echo task returning binary array.
/// </summary>
[Test]
- public void TestEchoTaskPortableArray()
+ public void TestEchoTaskBinarizableArray()
{
- var res = _grid1.GetCompute().ExecuteJavaTask<object[]>(EchoTask, EchoTypePortableArray);
+ var res = _grid1.GetCompute().ExecuteJavaTask<object[]>(EchoTask, EchoTypeBinarizableArray);
Assert.AreEqual(3, res.Length);
for (var i = 0; i < res.Length; i++)
- Assert.AreEqual(i + 1, ((PlatformComputePortable) res[i]).Field);
+ Assert.AreEqual(i + 1, ((PlatformComputeBinarizable) res[i]).Field);
}
/// <summary>
@@ -883,20 +883,20 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Test for portable argument in Java.
+ /// Test for binary argument in Java.
/// </summary>
[Test]
- public void TestPortableArgTask()
+ public void TestBinarizableArgTask()
{
ICompute compute = _grid1.GetCompute();
compute.WithKeepBinary();
- PlatformComputeNetPortable arg = new PlatformComputeNetPortable();
+ PlatformComputeNetBinarizable arg = new PlatformComputeNetBinarizable();
arg.Field = 100;
- int res = compute.ExecuteJavaTask<int>(PortableArgTask, arg);
+ int res = compute.ExecuteJavaTask<int>(BinaryArgTask, arg);
Assert.AreEqual(arg.Field, res);
}
@@ -1109,9 +1109,9 @@ namespace Apache.Ignite.Core.Tests.Compute
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PlatformComputePortable)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PlatformComputeNetPortable)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(JavaPortableCls));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PlatformComputeBinarizable)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PlatformComputeNetBinarizable)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(JavaBinaryCls));
portCfg.TypeConfigurations = portTypeCfgs;
@@ -1127,7 +1127,7 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
- class PlatformComputePortable
+ class PlatformComputeBinarizable
{
public int Field
{
@@ -1136,7 +1136,7 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
- class PlatformComputeNetPortable : PlatformComputePortable
+ class PlatformComputeNetBinarizable : PlatformComputeBinarizable
{
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
index 044b5a6..34a1573 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
@@ -73,10 +73,10 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Test for GridComputeJobFailoverException with portable job.
+ /// Test for GridComputeJobFailoverException with binary job.
/// </summary>
[Test]
- public void TestTaskAdapterFailoverExceptionPortable()
+ public void TestTaskAdapterFailoverExceptionBinarizable()
{
TestTaskAdapterFailoverException(false);
}
@@ -111,9 +111,9 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
{
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestPortableJob)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestBinarizableJob)));
}
/// <summary>
@@ -138,7 +138,7 @@ namespace Apache.Ignite.Core.Tests.Compute
if (serializable)
job = new TestSerializableJob();
else
- job = new TestPortableJob();
+ job = new TestBinarizableJob();
foreach (IClusterNode node in subgrid) {
bool add = local ? node.IsLocal : !node.IsLocal;
@@ -172,7 +172,7 @@ namespace Apache.Ignite.Core.Tests.Compute
class TestClosure : IComputeFunc<int>
{
[InstanceResource]
- private IIgnite _grid = null;
+ private readonly IIgnite _grid = null;
/** <inheritDoc /> */
public int Invoke()
@@ -188,7 +188,7 @@ namespace Apache.Ignite.Core.Tests.Compute
class TestSerializableJob : IComputeJob<int>
{
[InstanceResource]
- private IIgnite _grid = null;
+ private readonly IIgnite _grid = null;
/** <inheritDoc /> */
public int Execute()
@@ -206,10 +206,10 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- class TestPortableJob : IComputeJob<int>
+ class TestBinarizableJob : IComputeJob<int>
{
[InstanceResource]
- private IIgnite _grid = null;
+ private readonly IIgnite _grid = null;
/** <inheritDoc /> */
public int Execute()
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedBinarizableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedBinarizableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedBinarizableClosureTaskTest.cs
new file mode 100644
index 0000000..315bbbe
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedBinarizableClosureTaskTest.cs
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Compute.Forked
+{
+ /// <summary>
+ /// Forked closure execution tests for binary objects.
+ /// </summary>
+ public class ForkedBinarizableClosureTaskTest : BinarizableClosureTaskTest
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public ForkedBinarizableClosureTaskTest() : base(true) { }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs
deleted file mode 100644
index 4ce917b..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs
+++ /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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute.Forked
-{
- /// <summary>
- /// Forked closure execution tests for portable objects.
- /// </summary>
- public class ForkedPortableClosureTaskTest : PortableClosureTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ForkedPortableClosureTaskTest() : base(true) { }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
index 84c1ba2..a16db03 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
@@ -17,12 +17,9 @@
namespace Apache.Ignite.Core.Tests.Compute.Forked
{
- using NUnit.Framework;
-
/// <summary>
/// Forked resource task test.
/// </summary>
- [Ignore("IGNITE-1381")]
public class ForkedResourceTaskTest : ResourceTaskTest
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
index 0324125..c6582ad 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
@@ -17,12 +17,9 @@
namespace Apache.Ignite.Core.Tests.Compute.Forked
{
- using NUnit.Framework;
-
/// <summary>
/// Forked closure execution tests for serializable objects.
/// </summary>
- [Ignore("IGNITE-1381")]
public class ForkedSerializableClosureTaskTest : SerializableClosureTaskTest
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs
deleted file mode 100644
index bca5ab6..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs
+++ /dev/null
@@ -1,217 +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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// Closure execution tests for portable objects.
- /// </summary>
- public class PortableClosureTaskTest : ClosureTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public PortableClosureTaskTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected PortableClosureTaskTest(bool fork) : base(fork) { }
-
- /** <inheritDoc /> */
- protected override void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableOutFunc)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableFunc)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableResult)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableException)));
- }
-
- /** <inheritDoc /> */
- protected override IComputeFunc<object> OutFunc(bool err)
- {
- return new PortableOutFunc(err);
- }
-
- /** <inheritDoc /> */
- protected override IComputeFunc<object, object> Func(bool err)
- {
- return new PortableFunc(err);
- }
-
- /** <inheritDoc /> */
- protected override void CheckResult(object res)
- {
- Assert.IsTrue(res != null);
-
- PortableResult res0 = res as PortableResult;
-
- Assert.IsTrue(res0 != null);
- Assert.AreEqual(1, res0.Res);
- }
-
- /** <inheritDoc /> */
- protected override void CheckError(Exception err)
- {
- Assert.IsTrue(err != null);
-
- PortableException err0 = err as PortableException;
-
- Assert.IsTrue(err0 != null);
- Assert.AreEqual(ErrMsg, err0.Msg);
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableOutFunc : IComputeFunc<object>
- {
- /** Error. */
- private bool _err;
-
- /// <summary>
- ///
- /// </summary>
- public PortableOutFunc()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="err"></param>
- public PortableOutFunc(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public object Invoke()
- {
- if (_err)
- throw new PortableException(ErrMsg);
- return new PortableResult(1);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableFunc : IComputeFunc<object, object>
- {
- /** Error. */
- private bool _err;
-
- /// <summary>
- ///
- /// </summary>
- public PortableFunc()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="err"></param>
- public PortableFunc(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public object Invoke(object arg)
- {
- if (_err)
- throw new PortableException(ErrMsg);
- return new PortableResult(1);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableException : Exception, IBinarizable
- {
- /** */
- public string Msg;
-
- /// <summary>
- ///
- /// </summary>
- public PortableException()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="msg"></param>
- public PortableException(string msg) : this()
- {
- Msg = msg;
- }
-
- /** <inheritDoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.GetRawWriter().WriteString(Msg);
- }
-
- /** <inheritDoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- Msg = reader.GetRawReader().ReadString();
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableResult
- {
- /** */
- public int Res;
-
- /// <summary>
- ///
- /// </summary>
- public PortableResult()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="res"></param>
- public PortableResult(int res)
- {
- Res = res;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs
deleted file mode 100644
index 40a0f72..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs
+++ /dev/null
@@ -1,269 +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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Task test result.
- /// </summary>
- public class PortableTaskTest : AbstractTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public PortableTaskTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected PortableTaskTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestPortableObjectInTask()
- {
- var taskArg = new PortableWrapper {Item = ToPortable(Grid1, new PortableTaskArgument(100))};
-
- TestTask task = new TestTask(Grid1, taskArg);
-
- var res = Grid1.GetCompute().Execute(task, taskArg).Item;
-
- Assert.NotNull(res);
-
- Assert.AreEqual(400, res.GetField<int>("val"));
-
- PortableTaskResult resObj = res.Deserialize<PortableTaskResult>();
-
- Assert.AreEqual(400, resObj.Val);
- }
-
- private static IBinaryObject ToPortable(IIgnite grid, object obj)
- {
- var cache = grid.GetCache<object, object>(Cache1Name).WithKeepBinary<object, object>();
-
- cache.Put(1, obj);
-
- return (IBinaryObject) cache.Get(1);
- }
-
- /** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableJobArgument)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableJobResult)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableTaskArgument)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableTaskResult)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableJob)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableWrapper)));
- }
-
- /// <summary>
- /// Test task.
- /// </summary>
- class TestTask : ComputeTaskAdapter<PortableWrapper, PortableWrapper, PortableWrapper>
- {
- /** */
- private readonly IIgnite _grid;
-
- private readonly PortableWrapper _taskArgField;
-
- public TestTask(IIgnite grid, PortableWrapper taskArgField)
- {
- _grid = grid;
- _taskArgField = taskArgField;
- }
-
- /** <inheritDoc /> */
- override public IDictionary<IComputeJob<PortableWrapper>, IClusterNode> Map(IList<IClusterNode> subgrid, PortableWrapper arg)
- {
- Assert.AreEqual(3, subgrid.Count);
- Assert.NotNull(_grid);
-
- var taskArg = arg;
-
- CheckTaskArgument(taskArg);
-
- CheckTaskArgument(_taskArgField);
-
- var jobs = new Dictionary<IComputeJob<PortableWrapper>, IClusterNode>();
-
-
- foreach (IClusterNode node in subgrid)
- {
- if (!Grid3Name.Equals(node.GetAttribute<string>("org.apache.ignite.ignite.name"))) // Grid3 does not have cache.
- {
- var job = new PortableJob
- {
- Arg = new PortableWrapper {Item = ToPortable(_grid, new PortableJobArgument(200))}
- };
-
- jobs.Add(job, node);
- }
- }
-
- Assert.AreEqual(2, jobs.Count);
-
- return jobs;
- }
-
- private void CheckTaskArgument(PortableWrapper arg)
- {
- Assert.IsNotNull(arg);
-
- var taskArg = arg.Item;
-
- Assert.IsNotNull(taskArg);
-
- Assert.AreEqual(100, taskArg.GetField<int>("val"));
-
- PortableTaskArgument taskArgObj = taskArg.Deserialize<PortableTaskArgument>();
-
- Assert.AreEqual(100, taskArgObj.Val);
- }
-
- /** <inheritDoc /> */
- override public PortableWrapper Reduce(IList<IComputeJobResult<PortableWrapper>> results)
- {
- Assert.NotNull(_grid);
-
- Assert.AreEqual(2, results.Count);
-
- foreach (var res in results)
- {
- var jobRes = res.Data.Item;
-
- Assert.NotNull(jobRes);
-
- Assert.AreEqual(300, jobRes.GetField<int>("val"));
-
- PortableJobResult jobResObj = jobRes.Deserialize<PortableJobResult>();
-
- Assert.AreEqual(300, jobResObj.Val);
- }
-
- return new PortableWrapper {Item = ToPortable(_grid, new PortableTaskResult(400))};
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableJobArgument
- {
- /** */
- public int Val;
-
- public PortableJobArgument(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableJobResult
- {
- /** */
- public int Val;
-
- public PortableJobResult(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableTaskArgument
- {
- /** */
- public int Val;
-
- public PortableTaskArgument(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableTaskResult
- {
- /** */
- public int Val;
-
- public PortableTaskResult(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableJob : IComputeJob<PortableWrapper>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** */
- public PortableWrapper Arg;
-
- /** <inheritDoc /> */
-
- public PortableWrapper Execute()
- {
- Assert.IsNotNull(Arg);
-
- var arg = Arg.Item;
-
- Assert.IsNotNull(arg);
-
- Assert.AreEqual(200, arg.GetField<int>("val"));
-
- PortableJobArgument argObj = arg.Deserialize<PortableJobArgument>();
-
- Assert.AreEqual(200, argObj.Val);
-
- return new PortableWrapper {Item = ToPortable(_grid, new PortableJobResult(300))};
- }
-
- public void Cancel()
- {
- // No-op.
- }
- }
-
- class PortableWrapper
- {
- public IBinaryObject Item { get; set; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
index 57e23b8..8418306 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
@@ -88,7 +88,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// Test for job adapter.
/// </summary>
[Test]
- public void TestPortableJobAdapter()
+ public void TestBinarizableJobAdapter()
{
for (int i = 0; i < 10; i++)
{
@@ -99,9 +99,9 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
{
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableJob)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJob)));
}
/// <summary>
@@ -158,7 +158,7 @@ namespace Apache.Ignite.Core.Tests.Compute
if (serializable)
jobs.Add(new SerializableJob(100, "str"));
else
- jobs.Add(new PortableJob(100, "str"));
+ jobs.Add(new BinarizableJob(100, "str"));
return jobs;
}
@@ -236,14 +236,14 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Test portable job.
+ /// Test binary job.
/// </summary>
- public class PortableJob : ComputeJobAdapter<bool>
+ public class BinarizableJob : ComputeJobAdapter<bool>
{
[InstanceResource]
private IIgnite _grid = null;
- public PortableJob(params object[] args) : base(args)
+ public BinarizableJob(params object[] args) : base(args)
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
index 20b19a1..4bf1e21 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
@@ -99,19 +99,19 @@ namespace Apache.Ignite.Core.Tests.Compute
/// Test for task result.
/// </summary>
[Test]
- public void TestTaskResultPortable()
+ public void TestTaskResultBinarizable()
{
- TestTask<PortableResult> task = new TestTask<PortableResult>();
+ TestTask<BinarizableResult> task = new TestTask<BinarizableResult>();
- PortableResult val = new PortableResult(100);
+ BinarizableResult val = new BinarizableResult(100);
- PortableResult res = Grid1.GetCompute().Execute(task, new Tuple<bool, PortableResult>(true, val));
+ BinarizableResult res = Grid1.GetCompute().Execute(task, new Tuple<bool, BinarizableResult>(true, val));
Assert.AreEqual(val.Val, res.Val);
val.Val = 101;
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, PortableResult>(false, val));
+ res = Grid1.GetCompute().Execute(task, new Tuple<bool, BinarizableResult>(false, val));
Assert.AreEqual(val.Val, res.Val);
}
@@ -156,18 +156,18 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
{
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableResult)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestPortableJob)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableOutFunc)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableFunc)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestBinarizableJob)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableOutFunc)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFunc)));
}
[Test]
public void TestOutFuncResultPrimitive1()
{
- ICollection<int> res = Grid1.GetCompute().Broadcast(new PortableOutFunc());
+ ICollection<int> res = Grid1.GetCompute().Broadcast(new BinarizableOutFunc());
Assert.AreEqual(3, res.Count);
@@ -189,7 +189,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestFuncResultPrimitive1()
{
- ICollection<int> res = Grid1.GetCompute().Broadcast(new PortableFunc(), 10);
+ ICollection<int> res = Grid1.GetCompute().Broadcast(new BinarizableFunc(), 10);
Assert.AreEqual(3, res.Count);
@@ -216,7 +216,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Test function.
/// </summary>
- public class PortableFunc : IComputeFunc<int, int>, IUserInterface<int, int>
+ public class BinarizableFunc : IComputeFunc<int, int>, IUserInterface<int, int>
{
int IComputeFunc<int, int>.Invoke(int arg)
{
@@ -252,7 +252,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Test function.
/// </summary>
- public class PortableOutFunc : IComputeFunc<int>
+ public class BinarizableOutFunc : IComputeFunc<int>
{
public int Invoke()
{
@@ -291,9 +291,9 @@ namespace Apache.Ignite.Core.Tests.Compute
IComputeJob<T> job;
- if (res is PortableResult)
+ if (res is BinarizableResult)
{
- TestPortableJob job0 = new TestPortableJob();
+ TestBinarizableJob job0 = new TestBinarizableJob();
job0.SetArguments(res);
@@ -365,12 +365,12 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- class PortableResult
+ class BinarizableResult
{
/** */
public int Val;
- public PortableResult(int val)
+ public BinarizableResult(int val)
{
Val = val;
}
@@ -398,7 +398,7 @@ namespace Apache.Ignite.Core.Tests.Compute
class TestJob<T> : ComputeJobAdapter<T>
{
[InstanceResource]
- private IIgnite _grid = null;
+ private readonly IIgnite _grid = null;
/** <inheritDoc /> */
override public T Execute()
@@ -416,19 +416,19 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- class TestPortableJob : ComputeJobAdapter<PortableResult>
+ class TestBinarizableJob : ComputeJobAdapter<BinarizableResult>
{
[InstanceResource]
- private IIgnite _grid = null;
+ private readonly IIgnite _grid = null;
/** <inheritDoc /> */
- override public PortableResult Execute()
+ override public BinarizableResult Execute()
{
Assert.IsNotNull(_grid);
_gridName = _grid.Name;
- PortableResult res = GetArgument<PortableResult>(0);
+ BinarizableResult res = GetArgument<BinarizableResult>(0);
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index 0ad0070..e373b89 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@ -67,16 +67,16 @@
</bean>
</property>
- <!-- Portable marshaller configuration -->
+ <!-- Binary marshaller configuration -->
<property name="marshaller">
<bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
<property name="typeConfigurations">
<list>
<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
- <property name="className" value="org.apache.ignite.platform.PlatformComputePortable"/>
+ <property name="className" value="org.apache.ignite.platform.PlatformComputeBinarizable"/>
</bean>
<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
- <property name="className" value="org.apache.ignite.platform.PlatformComputeJavaPortable"/>
+ <property name="className" value="org.apache.ignite.platform.PlatformComputeJavaBinarizable"/>
</bean>
<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
<property name="className" value="org.apache.ignite.platform.PlatformComputeEnum"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
index 6447b4e..ddedf40 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
@@ -61,20 +61,20 @@
<list>
<value>Apache.Ignite.Core.Tests.ExecutableTest+RemoteConfiguration</value>
<value>Apache.Ignite.Core.Tests.ExecutableTest+RemoteConfigurationClosure</value>
- <value>Apache.Ignite.Core.Tests.Compute.TaskAdapterTest+PortableJob</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableOutFunc</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableFunc</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableResult</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableException</value>
+ <value>Apache.Ignite.Core.Tests.Compute.TaskAdapterTest+BinarizableJob</value>
+ <value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableOutFunc</value>
+ <value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableFunc</value>
+ <value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableResult</value>
+ <value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableException</value>
</list>
</property>
<property name="typesConfiguration">
<list>
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration">
- <property name="typeName" value="org.apache.ignite.platform.PlatformComputePortable"/>
+ <property name="typeName" value="org.apache.ignite.platform.PlatformComputeBinarizable"/>
</bean>
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration">
- <property name="typeName" value="org.apache.ignite.platform.PlatformComputeJavaPortable"/>
+ <property name="typeName" value="org.apache.ignite.platform.PlatformComputeJavaBinarizable"/>
</bean>
</list>
</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/binary.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/binary.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/binary.xml
new file mode 100644
index 0000000..f013749
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/binary.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+
+<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">
+ <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+ <property name="connectorConfiguration"><null/></property>
+
+ <property name="gridName" value="grid"/>
+
+ <property name="metricsUpdateFrequency" value="1000"/>
+ <property name="metricsLogFrequency" value="0"/>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache"/>
+ </bean>
+ </list>
+ </property>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47502</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
new file mode 100644
index 0000000..a31a450
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
@@ -0,0 +1,78 @@
+<?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.
+-->
+
+<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 id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+ <property name="connectorConfiguration"><null/></property>
+
+ <property name="platformConfiguration">
+ <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
+ <property name="binaryConfiguration">
+ <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration">
+ <property name="types">
+ <list>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Type]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64]]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Collections.Generic.List[System.Tuple[System.Int64,System.String]]]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,Apache.Ignite.Core.Tests.TestGenericBinarizable[System.String]]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String,System.Type]</value>
+ <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String,Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String,System.Type]]</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+
+ <property name="includeEventTypes">
+ <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
+ </property>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" />
+ </list>
+ </property>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47501</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml
deleted file mode 100644
index 26bf87b..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml
+++ /dev/null
@@ -1,78 +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.
--->
-
-<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 id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="binaryConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration">
- <property name="types">
- <list>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Type]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64]]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Collections.Generic.List[System.Tuple[System.Int64,System.String]]]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,Apache.Ignite.Core.Tests.TestGenericPortable[System.String]]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String,System.Type]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String,Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String,System.Type]]</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration" />
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
index 7f9ce40..86a46e4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
@@ -40,7 +40,7 @@
<property name="typeMetadata">
<list>
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
+ <property name="valueType" value="BinarizableEntry"/>
<property name="ascendingFields">
<map>
<entry key="val" value="java.lang.Integer"/>
@@ -70,7 +70,7 @@
<property name="typeMetadata">
<list>
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
+ <property name="valueType" value="BinarizableEntry"/>
<property name="ascendingFields">
<map>
<entry key="val" value="java.lang.Integer"/>
@@ -100,7 +100,7 @@
<property name="typeMetadata">
<list>
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
+ <property name="valueType" value="BinarizableEntry"/>
<property name="ascendingFields">
<map>
<entry key="val" value="java.lang.Integer"/>
@@ -130,7 +130,7 @@
<property name="typeMetadata">
<list>
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
+ <property name="valueType" value="BinarizableEntry"/>
<property name="ascendingFields">
<map>
<entry key="val" value="java.lang.Integer"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-explicit.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-explicit.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-explicit.xml
new file mode 100644
index 0000000..11b87bd
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-explicit.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+
+<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">
+ <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+ <property name="connectorConfiguration"><null/></property>
+
+ <property name="marshaller">
+ <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller" />
+ </property>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47502</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml
deleted file mode 100644
index 753fad1..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml
+++ /dev/null
@@ -1,43 +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.
--->
-
-<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">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
index 6845a3c..c2bf78c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
@@ -36,7 +36,7 @@
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="portable_store"/>
+ <property name="name" value="binary_store"/>
<property name="cacheMode" value="LOCAL"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeThrough" value="true"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
index c48e867..d8d4553 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
@@ -139,56 +139,5 @@
<property name="swapEnabled" value="true"/>
<property name="backups" value="1"/>
<property name="eagerTtl" value="true"/>
-
- <!--
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="GridPortablePerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>address</value>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="GridImplicitPortablePerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="GridNoDefPortablePerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- -->
</bean>
</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml
deleted file mode 100644
index f013749..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml
+++ /dev/null
@@ -1,56 +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.
--->
-
-<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">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid"/>
-
- <property name="metricsUpdateFrequency" value="1000"/>
- <property name="metricsLogFrequency" value="0"/>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
index 2f9f6c9..20ae629 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
@@ -383,7 +383,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
[Test]
public void TestStreamReceiver()
{
- TestStreamReceiver(new StreamReceiverPortable());
+ TestStreamReceiver(new StreamReceiverBinarizable());
TestStreamReceiver(new StreamReceiverSerializable());
}
@@ -403,7 +403,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
public void TestStreamTransformer()
{
TestStreamReceiver(new StreamTransformer<int, int, int, int>(new EntryProcessorSerializable()));
- TestStreamReceiver(new StreamTransformer<int, int, int, int>(new EntryProcessorPortable()));
+ TestStreamReceiver(new StreamTransformer<int, int, int, int>(new EntryProcessorBinarizable()));
}
/// <summary>
@@ -415,7 +415,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
{
ldr.AllowOverwrite = true;
- ldr.Receiver = new StreamReceiverPortable();
+ ldr.Receiver = new StreamReceiverBinarizable();
ldr.Receiver = receiver; // check double assignment
@@ -432,23 +432,23 @@ namespace Apache.Ignite.Core.Tests.Dataload
}
/// <summary>
- /// Tests the stream receiver in keepPortable mode.
+ /// Tests the stream receiver in keepBinary mode.
/// </summary>
[Test]
- public void TestStreamReceiverKeepPortable()
+ public void TestStreamReceiverKeepBinary()
{
// ReSharper disable once LocalVariableHidesMember
- var cache = _grid.GetCache<int, PortableEntry>(CacheName);
+ var cache = _grid.GetCache<int, BinarizableEntry>(CacheName);
using (var ldr0 = _grid.GetDataStreamer<int, int>(CacheName))
using (var ldr = ldr0.WithKeepBinary<int, IBinaryObject>())
{
- ldr.Receiver = new StreamReceiverKeepPortable();
+ ldr.Receiver = new StreamReceiverKeepBinary();
ldr.AllowOverwrite = true;
for (var i = 0; i < 100; i++)
- ldr.AddData(i, _grid.GetBinary().ToBinary<IBinaryObject>(new PortableEntry {Val = i}));
+ ldr.AddData(i, _grid.GetBinary().ToBinary<IBinaryObject>(new BinarizableEntry {Val = i}));
ldr.Flush();
@@ -474,9 +474,9 @@ namespace Apache.Ignite.Core.Tests.Dataload
{
new BinaryTypeConfiguration(typeof (CacheTestKey)),
new BinaryTypeConfiguration(typeof (TestReferenceObject)),
- new BinaryTypeConfiguration(typeof (StreamReceiverPortable)),
- new BinaryTypeConfiguration(typeof (EntryProcessorPortable)),
- new BinaryTypeConfiguration(typeof (PortableEntry))
+ new BinaryTypeConfiguration(typeof (StreamReceiverBinarizable)),
+ new BinaryTypeConfiguration(typeof (EntryProcessorBinarizable)),
+ new BinaryTypeConfiguration(typeof (BinarizableEntry))
}
},
JvmOptions = TestUtils.TestJavaOptions().Concat(new[]
@@ -497,9 +497,9 @@ namespace Apache.Ignite.Core.Tests.Dataload
}
/// <summary>
- /// Test portable receiver.
+ /// Test binarizable receiver.
/// </summary>
- private class StreamReceiverPortable : IStreamReceiver<int, int>
+ private class StreamReceiverBinarizable : IStreamReceiver<int, int>
{
/** <inheritdoc /> */
public void Receive(ICache<int, int> cache, ICollection<ICacheEntry<int, int>> entries)
@@ -509,20 +509,20 @@ namespace Apache.Ignite.Core.Tests.Dataload
}
/// <summary>
- /// Test portable receiver.
+ /// Test binary receiver.
/// </summary>
[Serializable]
- private class StreamReceiverKeepPortable : IStreamReceiver<int, IBinaryObject>
+ private class StreamReceiverKeepBinary : IStreamReceiver<int, IBinaryObject>
{
/** <inheritdoc /> */
public void Receive(ICache<int, IBinaryObject> cache, ICollection<ICacheEntry<int, IBinaryObject>> entries)
{
- var portables = cache.Ignite.GetBinary();
+ var binary = cache.Ignite.GetBinary();
cache.PutAll(entries.ToDictionary(x => x.Key, x =>
- portables.ToBinary<IBinaryObject>(new PortableEntry
+ binary.ToBinary<IBinaryObject>(new BinarizableEntry
{
- Val = x.Value.Deserialize<PortableEntry>().Val + 1
+ Val = x.Value.Deserialize<BinarizableEntry>().Val + 1
})));
}
}
@@ -558,7 +558,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
/// <summary>
/// Test entry processor.
/// </summary>
- private class EntryProcessorPortable : ICacheEntryProcessor<int, int, int, int>, IBinarizable
+ private class EntryProcessorBinarizable : ICacheEntryProcessor<int, int, int, int>, IBinarizable
{
/** <inheritdoc /> */
public int Process(IMutableCacheEntry<int, int> entry, int arg)
@@ -582,9 +582,9 @@ namespace Apache.Ignite.Core.Tests.Dataload
}
/// <summary>
- /// Portablecache entry.
+ /// Binarizable entry.
/// </summary>
- private class PortableEntry
+ private class BinarizableEntry
{
public int Val { get; set; }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 403f8a7..9f22355 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -365,7 +365,7 @@ namespace Apache.Ignite.Core.Tests
[Test]
public void TestRemoteListen(
[Values(true, false)] bool async,
- [Values(true, false)] bool portable,
+ [Values(true, false)] bool binarizable,
[Values(true, false)] bool autoUnsubscribe)
{
foreach (var g in _grids)
@@ -378,8 +378,8 @@ namespace Apache.Ignite.Core.Tests
var expectedType = EventType.JobStarted;
- var remoteFilter = portable
- ? (IEventFilter<IEvent>) new RemoteEventPortableFilter(expectedType)
+ var remoteFilter = binary
+ ? (IEventFilter<IEvent>) new RemoteEventBinarizableFilter(expectedType)
: new RemoteEventFilter(expectedType);
var localListener = EventsTestHelper.GetListener();
@@ -616,7 +616,7 @@ namespace Apache.Ignite.Core.Tests
{
TypeConfigurations = new List<BinaryTypeConfiguration>
{
- new BinaryTypeConfiguration(typeof (RemoteEventPortableFilter))
+ new BinaryTypeConfiguration(typeof (RemoteEventBinarizableFilter))
}
}
};
@@ -882,18 +882,18 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
- /// Portable remote event filter.
+ /// Binary remote event filter.
/// </summary>
- public class RemoteEventPortableFilter : IEventFilter<IEvent>, IBinarizable
+ public class RemoteEventBinarizableFilter : IEventFilter<IEvent>, IBinarizable
{
/** */
private int _type;
/// <summary>
- /// Initializes a new instance of the <see cref="RemoteEventPortableFilter"/> class.
+ /// Initializes a new instance of the <see cref="RemoteEventBinarizableFilter"/> class.
/// </summary>
/// <param name="type">The event type.</param>
- public RemoteEventPortableFilter(int type)
+ public RemoteEventBinarizableFilter(int type)
{
_type = type;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
index 196d8ae..79297da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
@@ -107,18 +107,18 @@ namespace Apache.Ignite.Core.Tests
TestPartialUpdateException(false, (x, g) => x);
// User type
- TestPartialUpdateException(false, (x, g) => new PortableEntry(x));
+ TestPartialUpdateException(false, (x, g) => new BinarizableEntry(x));
}
/// <summary>
- /// Tests CachePartialUpdateException keys propagation in portable mode.
+ /// Tests CachePartialUpdateException keys propagation in binary mode.
/// </summary>
[Test]
[Category(TestUtils.CategoryIntensive)]
- public void TestPartialUpdateExceptionPortable()
+ public void TestPartialUpdateExceptionBinarizable()
{
// User type
- TestPartialUpdateException(false, (x, g) => g.GetBinary().ToBinary<IBinaryObject>(new PortableEntry(x)));
+ TestPartialUpdateException(false, (x, g) => g.GetBinary().ToBinary<IBinaryObject>(new BinarizableEntry(x)));
}
/// <summary>
@@ -195,17 +195,17 @@ namespace Apache.Ignite.Core.Tests
TestPartialUpdateException(true, (x, g) => x);
// User type
- TestPartialUpdateException(true, (x, g) => new PortableEntry(x));
+ TestPartialUpdateException(true, (x, g) => new BinarizableEntry(x));
}
/// <summary>
- /// Tests CachePartialUpdateException keys propagation in portable mode.
+ /// Tests CachePartialUpdateException keys propagation in binary mode.
/// </summary>
[Test]
[Category(TestUtils.CategoryIntensive)]
- public void TestPartialUpdateExceptionAsyncPortable()
+ public void TestPartialUpdateExceptionAsyncBinarizable()
{
- TestPartialUpdateException(true, (x, g) => g.GetBinary().ToBinary<IBinaryObject>(new PortableEntry(x)));
+ TestPartialUpdateException(true, (x, g) => g.GetBinary().ToBinary<IBinaryObject>(new BinarizableEntry(x)));
}
/// <summary>
@@ -295,16 +295,16 @@ namespace Apache.Ignite.Core.Tests
{
TypeConfigurations = new[]
{
- new BinaryTypeConfiguration(typeof (PortableEntry))
+ new BinaryTypeConfiguration(typeof (BinarizableEntry))
}
}
});
}
/// <summary>
- /// Portable entry.
+ /// Binarizable entry.
/// </summary>
- private class PortableEntry
+ private class BinarizableEntry
{
/** Value. */
private readonly int _val;
@@ -319,7 +319,7 @@ namespace Apache.Ignite.Core.Tests
/// Constructor.
/// </summary>
/// <param name="val">Value.</param>
- public PortableEntry(int val)
+ public BinarizableEntry(int val)
{
_val = val;
}
@@ -327,12 +327,12 @@ namespace Apache.Ignite.Core.Tests
/** <inheritDoc /> */
public override bool Equals(object obj)
{
- return obj is PortableEntry && ((PortableEntry)obj)._val == _val;
+ return obj is BinarizableEntry && ((BinarizableEntry)obj)._val == _val;
}
}
/// <summary>
- /// Portable entry.
+ /// Serializable entry.
/// </summary>
[Serializable]
private class SerializableEntry
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
index e32f49a..f18be8c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
@@ -52,7 +52,7 @@ namespace Apache.Ignite.Core.Tests
BinaryConfiguration = new BinaryConfiguration
{
TypeConfigurations =
- new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof(Portable)) }
+ new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof(Binarizable)) }
}
});
@@ -107,7 +107,7 @@ namespace Apache.Ignite.Core.Tests
TestType(18m); // decimal
- TestType(new Portable { A = 10, B = "foo" });
+ TestType(new Binarizable { A = 10, B = "foo" });
}
/// <summary>
@@ -123,9 +123,9 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
- /// Portable test class.
+ /// Binary test class.
/// </summary>
- private class Portable : IBinarizable
+ private class Binarizable : IBinarizable
{
public int A;
public string B;
@@ -156,7 +156,7 @@ namespace Apache.Ignite.Core.Tests
if (obj.GetType() != GetType())
return false;
- var other = (Portable)obj;
+ var other = (Binarizable)obj;
return A == other.A && string.Equals(B, other.B);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
index d3af288..541de0c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
@@ -27,7 +27,7 @@ namespace Apache.Ignite.Core.Tests
{
/// <summary>
/// Tests the default marhsaller.
- /// By default, portable marshaller is used.
+ /// By default, binary marshaller is used.
/// </summary>
[Test]
public void TestDefaultMarhsaller()
@@ -43,13 +43,13 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
- /// Tests the portable marhsaller.
- /// PortableMarshaller can be specified explicitly in config.
+ /// Tests the binary marhsaller.
+ /// Marshaller can be specified explicitly in config.
/// </summary>
[Test]
- public void TestPortableMarhsaller()
+ public void TestExplicitMarhsaller()
{
- using (var grid = Ignition.Start("config\\marshaller-portable.xml"))
+ using (var grid = Ignition.Start("config\\marshaller-explicit.xml"))
{
var cache = grid.GetOrCreateCache<int, int>(null);
[12/50] [abbrv] ignite git commit: IGNITE-1885 ignite-zookeeper:
Upgrade Curator dependency to 2.9.1.
Posted by vo...@apache.org.
IGNITE-1885 ignite-zookeeper: Upgrade Curator dependency to 2.9.1.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cb28819f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cb28819f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cb28819f
Branch: refs/heads/ignite-1816
Commit: cb28819fcc004c209cc822eaddcbed374332921c
Parents: 77ee065
Author: Raul Kripalani <ra...@apache.org>
Authored: Tue Nov 10 21:09:36 2015 +0000
Committer: Raul Kripalani <ra...@apache.org>
Committed: Tue Nov 10 21:10:18 2015 +0000
----------------------------------------------------------------------
modules/zookeeper/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cb28819f/modules/zookeeper/pom.xml
----------------------------------------------------------------------
diff --git a/modules/zookeeper/pom.xml b/modules/zookeeper/pom.xml
index 9f5bc42..303b941 100644
--- a/modules/zookeeper/pom.xml
+++ b/modules/zookeeper/pom.xml
@@ -35,7 +35,7 @@
<url>http://ignite.apache.org</url>
<properties>
- <curator.version>2.8.0</curator.version>
+ <curator.version>2.9.1</curator.version>
</properties>
<dependencies>
[29/50] [abbrv] ignite git commit: Added advanced tests for
GridCacheLoadOnlyStoreAdapterSelfTest
Posted by vo...@apache.org.
Added advanced tests for GridCacheLoadOnlyStoreAdapterSelfTest
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d54fcbed
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d54fcbed
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d54fcbed
Branch: refs/heads/ignite-1816
Commit: d54fcbedf9fdc110de8e73387a6796852b0ff42c
Parents: 8014712
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Nov 17 11:56:01 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Nov 17 11:56:01 2015 +0300
----------------------------------------------------------------------
.../GridCacheLoadOnlyStoreAdapterSelfTest.java | 145 +++++++++++++++++--
1 file changed, 135 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d54fcbed/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
index 70fae9c..461f562 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.cache.store;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
+import javax.cache.integration.CacheLoaderException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.util.typedef.T2;
@@ -33,8 +34,8 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCacheAbstractSelf
/** Expected loadAll arguments, hardcoded on call site for convenience. */
private static final Integer[] EXP_ARGS = {1, 2, 3};
- /** Test input size. */
- private static final int INPUT_SIZE = 100;
+ /** Store to use. */
+ private CacheLoadOnlyStoreAdapter store;
/** {@inheritDoc} */
@Override protected int gridCount() {
@@ -42,11 +43,33 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCacheAbstractSelf
}
/** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+
+ }
+
+ /** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
CacheConfiguration cfg = super.cacheConfiguration(gridName);
- cfg.setCacheStoreFactory(singletonFactory(new TestStore()));
+ assertNotNull(store);
+
+ cfg.setCacheStoreFactory(singletonFactory(store));
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
cfg.setLoadPreviousValue(true);
@@ -58,20 +81,74 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCacheAbstractSelf
* @throws Exception If failed.
*/
public void testStore() throws Exception {
- jcache().localLoadCache(null, 1, 2, 3);
+ try {
+ int inputSize = 100;
+
+ store = new TestStore(inputSize);
+
+ startGrids(gridCount());
+
+ awaitPartitionMapExchange();
+
+ jcache().localLoadCache(null, 1, 2, 3);
+
+ int cnt = 0;
+
+ for (int i = 0; i < gridCount(); i++)
+ cnt += jcache(i).localSize();
+
+ assertEquals(inputSize - (inputSize / 10), cnt);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStoreSmallQueueSize() throws Exception {
+ try {
+ int inputSize = 1500;
+
+ store = new ParallelTestStore(inputSize);
+
+ store.setBatchSize(1);
+ store.setBatchQueueSize(1);
+ store.setThreadsCount(2);
+
+ startGrids(gridCount());
+
+ awaitPartitionMapExchange();
+
+ jcache().localLoadCache(null, 1, 2, 3);
- int cnt = 0;
+ int cnt = 0;
- for (int i = 0; i < gridCount(); i++)
- cnt += jcache(i).localSize();
+ for (int i = 0; i < gridCount(); i++)
+ cnt += jcache(i).localSize();
- assertEquals(INPUT_SIZE - (INPUT_SIZE/10), cnt);
+ assertEquals(inputSize, cnt);
+ }
+ finally {
+ stopAllGrids();
+ }
}
/**
*
*/
private static class TestStore extends CacheLoadOnlyStoreAdapter<Integer, String, String> {
+ /** */
+ private final int inputSize;
+
+ /**
+ * @param inputSize Input size.
+ */
+ public TestStore(int inputSize) {
+ this.inputSize = inputSize;
+ }
+
/** {@inheritDoc} */
@Override protected Iterator<String> inputIterator(@Nullable Object... args) {
assertNotNull(args);
@@ -81,7 +158,7 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCacheAbstractSelf
private int i = -1;
@Override public boolean hasNext() {
- return i < INPUT_SIZE;
+ return i < inputSize;
}
@Override public String next() {
@@ -111,4 +188,52 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCacheAbstractSelf
return i % 10 == 0 ? null : new T2<>(i, p[1]);
}
}
-}
\ No newline at end of file
+
+ /**
+ *
+ */
+ private static class ParallelTestStore extends CacheLoadOnlyStoreAdapter<Integer, String, String> {
+ /** */
+ private final int inputSize;
+
+ /**
+ * @param inputSize Input size.
+ */
+ public ParallelTestStore(int inputSize) {
+ this.inputSize = inputSize;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Iterator<String> inputIterator(@Nullable Object... args) throws CacheLoaderException {
+ return new Iterator<String>() {
+ private int i;
+
+ @Override public boolean hasNext() {
+ return i < inputSize;
+ }
+
+ @Override public String next() {
+ if (!hasNext())
+ throw new NoSuchElementException();
+
+ String res = i + "=str" + i;
+
+ i++;
+
+ return res;
+ }
+
+ @Override public void remove() {
+ // No-op.
+ }
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected IgniteBiTuple<Integer, String> parse(String rec, @Nullable Object... args) {
+ String[] p = rec.split("=");
+
+ return new T2<>(Integer.parseInt(p[0]), p[1]);
+ }
+ }
+}
[41/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
new file mode 100644
index 0000000..74ae244
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
@@ -0,0 +1,173 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Binary configuration tests.
+ /// </summary>
+ public class BinaryConfigurationTest
+ {
+ /** Cache. */
+ private ICache<int, TestGenericBinarizableBase> _cache;
+
+ /** Random generator. */
+ private static readonly Random Rnd = new Random();
+
+ /** Test types for code config */
+ private static readonly Type[] TestTypes = {
+ typeof (TestGenericBinarizable<int>),
+ typeof (TestGenericBinarizable<string>),
+ typeof (TestGenericBinarizable<TestGenericBinarizable<int>>),
+ typeof (TestGenericBinarizable<List<Tuple<int, string>>>),
+ typeof (TestGenericBinarizable<int, string>),
+ typeof (TestGenericBinarizable<int, TestGenericBinarizable<string>>),
+ typeof (TestGenericBinarizable<int, string, Type>),
+ typeof (TestGenericBinarizable<int, string, TestGenericBinarizable<int, string, Type>>)
+ };
+
+ /** Test types for xml config */
+ private static readonly Type[] TestTypesXml = {
+ typeof (TestGenericBinarizable<long>),
+ typeof (TestGenericBinarizable<Type>),
+ typeof (TestGenericBinarizable<TestGenericBinarizable<long>>),
+ typeof (TestGenericBinarizable<List<Tuple<long, string>>>),
+ typeof (TestGenericBinarizable<long, string>),
+ typeof (TestGenericBinarizable<long, TestGenericBinarizable<string>>),
+ typeof (TestGenericBinarizable<long, string, Type>),
+ typeof (TestGenericBinarizable<long, string, TestGenericBinarizable<long, string, Type>>)
+ };
+
+ /// <summary>
+ /// Starts the grid with provided config.
+ /// </summary>
+ /// <param name="binaryConfiguration">The binary configuration.</param>
+ private void StartGrid(BinaryConfiguration binaryConfiguration)
+ {
+ Ignition.StopAll(true);
+
+ var grid = Ignition.Start(new IgniteConfiguration
+ {
+ SpringConfigUrl = "config\\cache-binarizables.xml",
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ BinaryConfiguration = binaryConfiguration
+ });
+
+ _cache = grid.GetCache<int, TestGenericBinarizableBase>(null);
+ }
+
+ /// <summary>
+ /// Test fixture tear-down routine.
+ /// </summary>
+ [TestFixtureTearDown]
+ public void TestFixtureTearDown()
+ {
+ Ignition.StopAll(true);
+ }
+
+ /// <summary>
+ /// Tests the configuration set in code.
+ /// </summary>
+ [Test]
+ public void TestCodeConfiguration()
+ {
+ StartGrid(new BinaryConfiguration
+ {
+ TypeConfigurations = TestTypes.Select(x => new BinaryTypeConfiguration(x)).ToList()
+ });
+
+ CheckBinarizableTypes(TestTypes);
+ }
+
+ /// <summary>
+ /// Tests the configuration set in xml.
+ /// </summary>
+ [Test]
+ public void TestXmlConfiguration()
+ {
+ StartGrid(null);
+
+ CheckBinarizableTypes(TestTypesXml);
+ }
+
+ /// <summary>
+ /// Checks that specified types are binarizable and can be successfully used in cache.
+ /// </summary>
+ private void CheckBinarizableTypes(IEnumerable<Type> testTypes)
+ {
+ int key = 0;
+
+ foreach (var typ in testTypes)
+ {
+ key += 1;
+
+ var inst = CreateInstance(typ);
+
+ _cache.Put(key, inst);
+
+ var result = _cache.Get(key);
+
+ Assert.AreEqual(inst.Prop, result.Prop);
+
+ Assert.AreEqual(typ, result.GetType());
+ }
+ }
+
+ /// <summary>
+ /// Creates the instance of specified test binarizable type and sets a value on it.
+ /// </summary>
+ private static TestGenericBinarizableBase CreateInstance(Type type)
+ {
+ var inst = (TestGenericBinarizableBase)Activator.CreateInstance(type);
+
+ inst.Prop = Rnd.Next(int.MaxValue);
+
+ return inst;
+ }
+ }
+
+ public abstract class TestGenericBinarizableBase
+ {
+ public object Prop { get; set; }
+ }
+
+ public class TestGenericBinarizable<T> : TestGenericBinarizableBase
+ {
+ public T Prop1 { get; set; }
+ }
+
+ public class TestGenericBinarizable<T1, T2> : TestGenericBinarizableBase
+ {
+ public T1 Prop1 { get; set; }
+ public T2 Prop2 { get; set; }
+ }
+
+ public class TestGenericBinarizable<T1, T2, T3> : TestGenericBinarizableBase
+ {
+ public T1 Prop1 { get; set; }
+ public T2 Prop2 { get; set; }
+ public T3 Prop3 { get; set; }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 7df0e5a..64124d7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -148,7 +148,7 @@ namespace Apache.Ignite.Core.Tests.Cache
public bool ThrowErr { get; set; }
// Error flag
- public bool ThrowErrPortable { get; set; }
+ public bool ThrowErrBinarizable { get; set; }
// Error flag
public bool ThrowErrNonSerializable { get; set; }
@@ -179,8 +179,8 @@ namespace Apache.Ignite.Core.Tests.Cache
if (ThrowErr)
throw new Exception(ExceptionText);
- if (ThrowErrPortable)
- throw new PortableTestException {Info = ExceptionText};
+ if (ThrowErrBinarizable)
+ throw new BinarizableTestException {Info = ExceptionText};
if (ThrowErrNonSerializable)
throw new NonSerializableException();
@@ -204,9 +204,9 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Portable add processor.
+ /// Binary add processor.
/// </summary>
- public class PortableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
+ public class BinarizableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
{
/** <inheritdoc /> */
public void WriteBinary(IBinaryWriter writer)
@@ -214,7 +214,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var w = writer.GetRawWriter();
w.WriteBoolean(ThrowErr);
- w.WriteBoolean(ThrowErrPortable);
+ w.WriteBoolean(ThrowErrBinarizable);
w.WriteBoolean(ThrowErrNonSerializable);
w.WriteInt(ThrowOnKey);
w.WriteBoolean(Remove);
@@ -227,7 +227,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var r = reader.GetRawReader();
ThrowErr = r.ReadBoolean();
- ThrowErrPortable = r.ReadBoolean();
+ ThrowErrBinarizable = r.ReadBoolean();
ThrowErrNonSerializable = r.ReadBoolean();
ThrowOnKey = r.ReadInt();
Remove = r.ReadBoolean();
@@ -244,9 +244,9 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Portable exception.
+ /// Binary exception.
/// </summary>
- public class PortableTestException : Exception, IBinarizable
+ public class BinarizableTestException : Exception, IBinarizable
{
/// <summary>
/// Gets or sets exception info.
@@ -298,11 +298,11 @@ namespace Apache.Ignite.Core.Tests.Cache
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortablePerson)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizablePerson)));
portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(CacheTestKey)));
portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestReferenceObject)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableAddArgCacheEntryProcessor)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableTestException)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableAddArgCacheEntryProcessor)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTestException)));
portCfg.TypeConfigurations = portTypeCfgs;
@@ -1558,11 +1558,11 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestPutGetPortable()
+ public void TestPutGetBinary()
{
- var cache = Cache<int, PortablePerson>();
+ var cache = Cache<int, BinarizablePerson>();
- PortablePerson obj1 = new PortablePerson("obj1", 1);
+ BinarizablePerson obj1 = new BinarizablePerson("obj1", 1);
cache.Put(1, obj1);
@@ -1573,11 +1573,11 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestPutGetPortableAsync()
+ public void TestPutGetBinaryAsync()
{
- var cache = Cache<int, PortablePerson>().WrapAsync();
+ var cache = Cache<int, BinarizablePerson>().WrapAsync();
- PortablePerson obj1 = new PortablePerson("obj1", 1);
+ BinarizablePerson obj1 = new BinarizablePerson("obj1", 1);
cache.Put(1, obj1);
@@ -1588,7 +1588,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestPutGetPortableKey()
+ public void TestPutGetBinaryKey()
{
var cache = Cache<CacheTestKey, string>();
@@ -1674,7 +1674,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Category(TestUtils.CategoryIntensive)]
public void TestPutGetAsyncMultithreaded()
{
- var cache = Cache<CacheTestKey, PortablePerson>();
+ var cache = Cache<CacheTestKey, BinarizablePerson>();
const int threads = 10;
const int objPerThread = 1000;
@@ -1692,7 +1692,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- futs.Add(cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key)));
+ futs.Add(cache.PutAsync(new CacheTestKey(key), new BinarizablePerson("Person-" + key, key)));
}
foreach (var fut in futs)
@@ -1729,7 +1729,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key)).Wait();
+ cache.PutAsync(new CacheTestKey(key), new BinarizablePerson("Person-" + key, key)).Wait();
}
}, threads);
@@ -1739,7 +1739,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<Task<PortablePerson>>();
+ var futs = new List<Task<BinarizablePerson>>();
for (int i = 0; i < objPerThread; i++)
{
@@ -1765,9 +1765,9 @@ namespace Apache.Ignite.Core.Tests.Cache
//[Test]
//[Category(TestUtils.CATEGORY_INTENSIVE)]
- public void TestAsyncMultithreadedKeepPortable()
+ public void TestAsyncMultithreadedKeepBinary()
{
- var cache = Cache().WithKeepBinary<CacheTestKey, PortablePerson>();
+ var cache = Cache().WithKeepBinary<CacheTestKey, BinarizablePerson>();
var portCache = Cache().WithKeepBinary<CacheTestKey, IBinaryObject>();
const int threads = 10;
@@ -1786,7 +1786,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- var task = cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
+ var task = cache.PutAsync(new CacheTestKey(key), new BinarizablePerson("Person-" + key, key));
futs.Add(task);
}
@@ -2742,15 +2742,15 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestKeepPortableFlag()
+ public void TestKeepBinaryFlag()
{
- TestKeepPortableFlag(false);
+ TestKeepBinaryFlag(false);
}
[Test]
- public void TestKeepPortableFlagAsync()
+ public void TestKeepBinaryFlagAsync()
{
- TestKeepPortableFlag(true);
+ TestKeepBinaryFlag(true);
}
[Test]
@@ -2793,7 +2793,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestSerializableKeepPortable()
+ public void TestSerializableKeepBinary()
{
var cache = Cache<int, TestSerializableObject>();
@@ -2801,9 +2801,9 @@ namespace Apache.Ignite.Core.Tests.Cache
cache.Put(1, obj);
- var portableResult = cache.WithKeepBinary<int, IBinaryObject>().Get(1);
+ var binaryRes = cache.WithKeepBinary<int, IBinaryObject>().Get(1);
- var resultObj = portableResult.Deserialize<TestSerializableObject>();
+ var resultObj = binaryRes.Deserialize<TestSerializableObject>();
Assert.AreEqual(obj, resultObj);
}
@@ -2823,7 +2823,7 @@ namespace Apache.Ignite.Core.Tests.Cache
private void TestInvoke(bool async)
{
TestInvoke<AddArgCacheEntryProcessor>(async);
- TestInvoke<PortableAddArgCacheEntryProcessor>(async);
+ TestInvoke<BinarizableAddArgCacheEntryProcessor>(async);
try
{
@@ -2863,7 +2863,7 @@ namespace Apache.Ignite.Core.Tests.Cache
// Test exceptions
AssertThrowsCacheEntryProcessorException(() => cache.Invoke(key, new T {ThrowErr = true}, arg));
AssertThrowsCacheEntryProcessorException(
- () => cache.Invoke(key, new T {ThrowErrPortable = true}, arg));
+ () => cache.Invoke(key, new T {ThrowErrBinarizable = true}, arg));
AssertThrowsCacheEntryProcessorException(
() => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "BinaryObjectException");
}
@@ -2904,7 +2904,7 @@ namespace Apache.Ignite.Core.Tests.Cache
for (var i = 1; i < 10; i++)
{
TestInvokeAll<AddArgCacheEntryProcessor>(async, i);
- TestInvokeAll<PortableAddArgCacheEntryProcessor>(async, i);
+ TestInvokeAll<BinarizableAddArgCacheEntryProcessor>(async, i);
try
{
@@ -2956,7 +2956,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var errKey = entries.Keys.Reverse().Take(5).Last();
TestInvokeAllException(cache, entries, new T { ThrowErr = true, ThrowOnKey = errKey }, arg, errKey);
- TestInvokeAllException(cache, entries, new T { ThrowErrPortable = true, ThrowOnKey = errKey },
+ TestInvokeAllException(cache, entries, new T { ThrowErrBinarizable = true, ThrowOnKey = errKey },
arg, errKey);
TestInvokeAllException(cache, entries, new T { ThrowErrNonSerializable = true, ThrowOnKey = errKey },
arg, errKey, "BinaryObjectException");
@@ -3088,20 +3088,20 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(5, cache[1]);
}
- private void TestKeepPortableFlag(bool async)
+ private void TestKeepBinaryFlag(bool async)
{
var cache0 = async ? Cache().WrapAsync() : Cache();
- var cache = cache0.WithKeepBinary<int, PortablePerson>();
+ var cache = cache0.WithKeepBinary<int, BinarizablePerson>();
- var portCache = cache0.WithKeepBinary<int, IBinaryObject>();
+ var binCache = cache0.WithKeepBinary<int, IBinaryObject>();
int cnt = 10;
IList<int> keys = new List<int>();
for (int i = 0; i < cnt; i++ ) {
- cache.Put(i, new PortablePerson("person-" + i, i));
+ cache.Put(i, new BinarizablePerson("person-" + i, i));
keys.Add(i);
}
@@ -3110,7 +3110,7 @@ namespace Apache.Ignite.Core.Tests.Cache
for (int i = 0; i < cnt; i++)
{
- var obj = portCache.Get(i);
+ var obj = binCache.Get(i);
CheckPersonData(obj, "person-" + i, i);
@@ -3125,10 +3125,10 @@ namespace Apache.Ignite.Core.Tests.Cache
CheckPersonData(obj, "person-" + i, i);
}
- // Check keepPortable for GetAll operation.
- var allObjs1 = portCache.GetAll(keys);
+ // Check keepBinary for GetAll operation.
+ var allObjs1 = binCache.GetAll(keys);
- var allObjs2 = portCache.GetAll(keys);
+ var allObjs2 = binCache.GetAll(keys);
for (int i = 0; i < cnt; i++)
{
@@ -3137,7 +3137,7 @@ namespace Apache.Ignite.Core.Tests.Cache
CheckPersonData(allObjs2[i], "person-" + i, i);
}
- // Check keepPortable for Remove operation.
+ // Check keepBinary for Remove operation.
var success0 = cache.Remove(0);
var success1 = cache.Remove(1);
@@ -3150,7 +3150,7 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(expName, obj.GetField<string>("name"));
Assert.AreEqual(expAge, obj.GetField<int>("age"));
- PortablePerson person = obj.Deserialize<PortablePerson>();
+ BinarizablePerson person = obj.Deserialize<BinarizablePerson>();
Assert.AreEqual(expName, person.Name);
Assert.AreEqual(expAge, person.Age);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
index abb9e02..5a1af03 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
@@ -77,10 +77,10 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Test affinity with portable flag.
+ /// Test affinity with binary flag.
/// </summary>
[Test]
- public void TestAffinityPortable()
+ public void TestAffinityBinary()
{
IIgnite g = Ignition.GetIgnite("grid-0");
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
index 693a664..63443b7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
@@ -109,17 +109,17 @@ namespace Apache.Ignite.Core.Tests.Cache
{
Assert.Throws<ArgumentException>(() =>
{
- Ignition.GetIgnite(GridData).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
+ Ignition.GetIgnite(GridData).GetCache<CacheTestKey, BinarizablePerson>(CacheDummy);
});
Assert.Throws<ArgumentException>(() =>
{
- Ignition.GetIgnite(GridDataNoCfg).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
+ Ignition.GetIgnite(GridDataNoCfg).GetCache<CacheTestKey, BinarizablePerson>(CacheDummy);
});
Assert.Throws<ArgumentException>(() =>
{
- Ignition.GetIgnite(GridClient).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
+ Ignition.GetIgnite(GridClient).GetCache<CacheTestKey, BinarizablePerson>(CacheDummy);
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index 74c4801..411ef05 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -64,8 +64,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
TypeConfigurations = new[]
{
new BinaryTypeConfiguration(typeof (QueryPerson)),
- new BinaryTypeConfiguration(typeof (PortableScanQueryFilter<QueryPerson>)),
- new BinaryTypeConfiguration(typeof (PortableScanQueryFilter<BinaryObject>))
+ new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<QueryPerson>)),
+ new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<BinaryObject>))
}
},
JvmClasspath = TestUtils.CreateTestClasspath(),
@@ -359,10 +359,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check SQL query in portable mode.
+ /// Check SQL query in binary mode.
/// </summary>
[Test]
- public void TestSqlQueryPortable()
+ public void TestSqlQueryBinary()
{
CheckSqlQuery(MaxItemCnt, false, true);
}
@@ -377,10 +377,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check local SQL query in portable mode.
+ /// Check local SQL query in binary mode.
/// </summary>
[Test]
- public void TestSqlQueryLocalPortable()
+ public void TestSqlQueryLocalBinary()
{
CheckSqlQuery(MaxItemCnt, true, true);
}
@@ -390,8 +390,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckSqlQuery(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckSqlQuery(int cnt, bool loc, bool keepBinary)
{
var cache = Cache();
@@ -402,7 +402,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
SqlQuery qry = loc ? new SqlQuery(typeof(QueryPerson), "age < 50", true) :
new SqlQuery(typeof(QueryPerson), "age < 50");
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
}
/// <summary>
@@ -479,10 +479,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check SQL query in portable mode.
+ /// Check SQL query in binary mode.
/// </summary>
[Test]
- public void TestTextQueryPortable()
+ public void TestTextQueryBinary()
{
CheckTextQuery(MaxItemCnt, false, true);
}
@@ -497,10 +497,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check local SQL query in portable mode.
+ /// Check local SQL query in binary mode.
/// </summary>
[Test]
- public void TestTextQueryLocalPortable()
+ public void TestTextQueryLocalBinary()
{
CheckTextQuery(MaxItemCnt, true, true);
}
@@ -510,8 +510,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckTextQuery(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckTextQuery(int cnt, bool loc, bool keepBinary)
{
var cache = Cache();
@@ -522,7 +522,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
TextQuery qry = loc ? new TextQuery(typeof(QueryPerson), "1*", true) :
new TextQuery(typeof(QueryPerson), "1*");
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
}
/// <summary>
@@ -535,10 +535,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check scan query in portable mode.
+ /// Check scan query in binary mode.
/// </summary>
[Test]
- public void TestScanQueryPortable()
+ public void TestScanQueryBinary()
{
CheckScanQuery<BinaryObject>(MaxItemCnt, false, true);
}
@@ -553,10 +553,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check local scan query in portable mode.
+ /// Check local scan query in binary mode.
/// </summary>
[Test]
- public void TestScanQueryLocalPortable()
+ public void TestScanQueryLocalBinary()
{
CheckScanQuery<BinaryObject>(MaxItemCnt, true, true);
}
@@ -572,11 +572,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check scan query with partitions in portable mode.
+ /// Check scan query with partitions in binary mode.
/// </summary>
[Test]
[Ignore("IGNITE-1012")]
- public void TestScanQueryPartitionsPortable([Values(true, false)] bool loc)
+ public void TestScanQueryPartitionsBinary([Values(true, false)] bool loc)
{
CheckScanQueryPartitions<BinaryObject>(MaxItemCnt, loc, true);
}
@@ -609,36 +609,36 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckScanQuery<TV>(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckScanQuery<TV>(int cnt, bool loc, bool keepBinary)
{
var cache = Cache();
// No predicate
var exp = PopulateCache(cache, loc, cnt, x => true);
var qry = new ScanQuery<int, TV>();
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
// Serializable
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV>());
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
- // Portable
+ // Binarizable
exp = PopulateCache(cache, loc, cnt, x => x < 50);
- qry = new ScanQuery<int, TV>(new PortableScanQueryFilter<TV>());
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ qry = new ScanQuery<int, TV>(new BinarizableScanQueryFilter<TV>());
+ ValidateQueryResults(cache, qry, exp, keepBinary);
// Invalid
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new InvalidScanQueryFilter<TV>());
- Assert.Throws<BinaryObjectException>(() => ValidateQueryResults(cache, qry, exp, keepPortable));
+ Assert.Throws<BinaryObjectException>(() => ValidateQueryResults(cache, qry, exp, keepBinary));
// Exception
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV> {ThrowErr = true});
- var ex = Assert.Throws<IgniteException>(() => ValidateQueryResults(cache, qry, exp, keepPortable));
+ var ex = Assert.Throws<IgniteException>(() => ValidateQueryResults(cache, qry, exp, keepBinary));
Assert.AreEqual(ScanQueryFilter<TV>.ErrMessage, ex.Message);
}
@@ -647,8 +647,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckScanQueryPartitions<TV>(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckScanQueryPartitions<TV>(int cnt, bool loc, bool keepBinary)
{
StopGrids();
StartGrids();
@@ -669,7 +669,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var qry = new ScanQuery<int, TV> { Partition = part };
Console.WriteLine("Checking query on partition " + part);
- ValidateQueryResults(cache, qry, exp0, keepPortable);
+ ValidateQueryResults(cache, qry, exp0, keepBinary);
}
// Partitions with predicate
@@ -686,7 +686,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV>()) { Partition = part };
Console.WriteLine("Checking predicate query on partition " + part);
- ValidateQueryResults(cache, qry, exp0, keepPortable);
+ ValidateQueryResults(cache, qry, exp0, keepBinary);
}
}
@@ -697,11 +697,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// <param name="cache">Cache.</param>
/// <param name="qry">Query.</param>
/// <param name="exp">Expected keys.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
+ /// <param name="keepBinary">Keep binary flag.</param>
private static void ValidateQueryResults(ICache<int, QueryPerson> cache, QueryBase qry, HashSet<int> exp,
- bool keepPortable)
+ bool keepBinary)
{
- if (keepPortable)
+ if (keepBinary)
{
var cache0 = cache.WithKeepBinary<int, IBinaryObject>();
@@ -906,9 +906,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Portable query filter.
+ /// binary query filter.
/// </summary>
- public class PortableScanQueryFilter<TV> : ScanQueryFilter<TV>, IBinarizable
+ public class BinarizableScanQueryFilter<TV> : ScanQueryFilter<TV>, IBinarizable
{
/** <inheritdoc /> */
public void WriteBinary(IBinaryWriter writer)
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index b81405b..cb9542f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -69,10 +69,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
private IIgnite grid2;
/** Cache on the first node. */
- private ICache<int, PortableEntry> cache1;
+ private ICache<int, BinarizableEntry> cache1;
/** Cache on the second node. */
- private ICache<int, PortableEntry> cache2;
+ private ICache<int, BinarizableEntry> cache2;
/** Cache name. */
private readonly string cacheName;
@@ -101,9 +101,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableEntry)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableFilter)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(KeepPortableFilter)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableEntry)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFilter)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(KeepBinaryFilter)));
portCfg.TypeConfigurations = portTypeCfgs;
@@ -114,11 +114,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
cfg.GridName = "grid-1";
grid1 = Ignition.Start(cfg);
- cache1 = grid1.GetCache<int, PortableEntry>(cacheName);
+ cache1 = grid1.GetCache<int, BinarizableEntry>(cacheName);
cfg.GridName = "grid-2";
grid2 = Ignition.Start(cfg);
- cache2 = grid2.GetCache<int, PortableEntry>(cacheName);
+ cache2 = grid2.GetCache<int, BinarizableEntry>(cacheName);
}
/// <summary>
@@ -139,10 +139,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
CB_EVTS = new BlockingCollection<CallbackEvent>();
FILTER_EVTS = new BlockingCollection<FilterEvent>();
- AbstractFilter<PortableEntry>.res = true;
- AbstractFilter<PortableEntry>.err = false;
- AbstractFilter<PortableEntry>.marshErr = false;
- AbstractFilter<PortableEntry>.unmarshErr = false;
+ AbstractFilter<BinarizableEntry>.res = true;
+ AbstractFilter<BinarizableEntry>.err = false;
+ AbstractFilter<BinarizableEntry>.marshErr = false;
+ AbstractFilter<BinarizableEntry>.unmarshErr = false;
cache1.Remove(PrimaryKey(cache1));
cache1.Remove(PrimaryKey(cache2));
@@ -159,7 +159,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
[Test]
public void TestValidation()
{
- Assert.Throws<ArgumentException>(() => { cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(null)); });
+ Assert.Throws<ArgumentException>(() => { cache1.QueryContinuous(new ContinuousQuery<int, BinarizableEntry>(null)); });
}
/// <summary>
@@ -171,8 +171,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
int key1 = PrimaryKey(cache1);
int key2 = PrimaryKey(cache2);
- ContinuousQuery<int, PortableEntry> qry =
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry =
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
IDisposable qryHnd;
@@ -208,9 +208,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
int key1 = PrimaryKey(cache1);
int key2 = PrimaryKey(cache2);
- ContinuousQuery<int, PortableEntry> qry = loc ?
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>(), true) :
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry = loc ?
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>(), true) :
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
using (cache1.QueryContinuous(qry))
{
@@ -260,21 +260,21 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
[Test]
public void TestCallbackInjection()
{
- Listener<PortableEntry> cb = new Listener<PortableEntry>();
+ Listener<BinarizableEntry> cb = new Listener<BinarizableEntry>();
Assert.IsNull(cb.ignite);
- using (cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(cb)))
+ using (cache1.QueryContinuous(new ContinuousQuery<int, BinarizableEntry>(cb)))
{
Assert.IsNotNull(cb.ignite);
}
}
/// <summary>
- /// Test portable filter logic.
+ /// Test binarizable filter logic.
/// </summary>
[Test]
- public void TestFilterPortable()
+ public void TestFilterBinarizable()
{
CheckFilter(true, false);
}
@@ -291,17 +291,17 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter.
/// </summary>
- /// <param name="portable">Portable.</param>
+ /// <param name="binarizable">Binarizable.</param>
/// <param name="loc">Local cache flag.</param>
- protected void CheckFilter(bool portable, bool loc)
+ protected void CheckFilter(bool binarizable, bool loc)
{
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>) new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = loc ?
- new ContinuousQuery<int, PortableEntry>(lsnr, filter, true) :
- new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = loc ?
+ new ContinuousQuery<int, BinarizableEntry>(lsnr, filter, true) :
+ new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
using (cache1.QueryContinuous(qry))
{
@@ -326,7 +326,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
CheckCallbackSingle(key2, null, Entry(key2));
}
- AbstractFilter<PortableEntry>.res = false;
+ AbstractFilter<BinarizableEntry>.res = false;
// Ignored put from local node.
cache1.GetAndPut(key1, Entry(key1 + 1));
@@ -346,11 +346,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter error during invoke.
+ /// Test binarizable filter error during invoke.
/// </summary>
[Ignore("IGNITE-521")]
[Test]
- public void TestFilterInvokeErrorPortable()
+ public void TestFilterInvokeErrorBinarizable()
{
CheckFilterInvokeError(true);
}
@@ -368,15 +368,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter error handling logic during invoke.
/// </summary>
- private void CheckFilterInvokeError(bool portable)
+ private void CheckFilterInvokeError(bool binarizable)
{
- AbstractFilter<PortableEntry>.err = true;
+ AbstractFilter<BinarizableEntry>.err = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>) new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>) new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
using (cache1.QueryContinuous(qry))
{
@@ -415,10 +415,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter marshalling error.
+ /// Test binarizable filter marshalling error.
/// </summary>
[Test]
- public void TestFilterMarshalErrorPortable()
+ public void TestFilterMarshalErrorBinarizable()
{
CheckFilterMarshalError(true);
}
@@ -435,16 +435,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter marshal error handling.
/// </summary>
- /// <param name="portable">Portable flag.</param>
- private void CheckFilterMarshalError(bool portable)
+ /// <param name="binarizable">Binarizable flag.</param>
+ private void CheckFilterMarshalError(bool binarizable)
{
- AbstractFilter<PortableEntry>.marshErr = true;
+ AbstractFilter<BinarizableEntry>.marshErr = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>)new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
Assert.Throws<Exception>(() =>
{
@@ -470,14 +470,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="loc"></param>
protected void CheckFilterNonSerializable(bool loc)
{
- AbstractFilter<PortableEntry>.unmarshErr = true;
+ AbstractFilter<BinarizableEntry>.unmarshErr = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter = new LocalFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter = new LocalFilter();
- ContinuousQuery<int, PortableEntry> qry = loc
- ? new ContinuousQuery<int, PortableEntry>(lsnr, filter, true)
- : new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = loc
+ ? new ContinuousQuery<int, BinarizableEntry>(lsnr, filter, true)
+ : new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
if (loc)
{
@@ -502,11 +502,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter unmarshalling error.
+ /// Test binarizable filter unmarshalling error.
/// </summary>
[Ignore("IGNITE-521")]
[Test]
- public void TestFilterUnmarshalErrorPortable()
+ public void TestFilterUnmarshalErrorBinarizable()
{
CheckFilterUnmarshalError(true);
}
@@ -524,16 +524,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter unmarshal error handling.
/// </summary>
- /// <param name="portable">Portable flag.</param>
- private void CheckFilterUnmarshalError(bool portable)
+ /// <param name="binarizable">Binarizable flag.</param>
+ private void CheckFilterUnmarshalError(bool binarizable)
{
- AbstractFilter<PortableEntry>.unmarshErr = true;
+ AbstractFilter<BinarizableEntry>.unmarshErr = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>) new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
using (cache1.QueryContinuous(qry))
{
@@ -566,12 +566,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
[Test]
public void TestFilterInjection()
{
- Listener<PortableEntry> cb = new Listener<PortableEntry>();
- PortableFilter filter = new PortableFilter();
+ Listener<BinarizableEntry> cb = new Listener<BinarizableEntry>();
+ BinarizableFilter filter = new BinarizableFilter();
Assert.IsNull(filter.ignite);
- using (cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(cb, filter)))
+ using (cache1.QueryContinuous(new ContinuousQuery<int, BinarizableEntry>(cb, filter)))
{
// Local injection.
Assert.IsNotNull(filter.ignite);
@@ -589,15 +589,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
- /// Test "keep-portable" scenario.
+ /// Test "keep-binary" scenario.
/// </summary>
[Test]
- public void TestKeepPortable()
+ public void TestKeepBinary()
{
var cache = cache1.WithKeepBinary<int, IBinaryObject>();
ContinuousQuery<int, IBinaryObject> qry = new ContinuousQuery<int, IBinaryObject>(
- new Listener<IBinaryObject>(), new KeepPortableFilter());
+ new Listener<IBinaryObject>(), new KeepBinaryFilter());
using (cache.QueryContinuous(qry))
{
@@ -611,14 +611,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
Assert.AreEqual(PrimaryKey(cache1), filterEvt.entry.Key);
Assert.AreEqual(null, filterEvt.entry.OldValue);
Assert.AreEqual(Entry(1), (filterEvt.entry.Value as IBinaryObject)
- .Deserialize<PortableEntry>());
+ .Deserialize<BinarizableEntry>());
Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
Assert.AreEqual(1, cbEvt.entries.Count);
Assert.AreEqual(PrimaryKey(cache1), cbEvt.entries.First().Key);
Assert.AreEqual(null, cbEvt.entries.First().OldValue);
Assert.AreEqual(Entry(1), (cbEvt.entries.First().Value as IBinaryObject)
- .Deserialize<PortableEntry>());
+ .Deserialize<BinarizableEntry>());
// 2. Remote put.
cache1.GetAndPut(PrimaryKey(cache2), Entry(2));
@@ -627,14 +627,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
Assert.AreEqual(PrimaryKey(cache2), filterEvt.entry.Key);
Assert.AreEqual(null, filterEvt.entry.OldValue);
Assert.AreEqual(Entry(2), (filterEvt.entry.Value as IBinaryObject)
- .Deserialize<PortableEntry>());
+ .Deserialize<BinarizableEntry>());
Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
Assert.AreEqual(1, cbEvt.entries.Count);
Assert.AreEqual(PrimaryKey(cache2), cbEvt.entries.First().Key);
Assert.AreEqual(null, cbEvt.entries.First().OldValue);
Assert.AreEqual(Entry(2),
- (cbEvt.entries.First().Value as IBinaryObject).Deserialize<PortableEntry>());
+ (cbEvt.entries.First().Value as IBinaryObject).Deserialize<BinarizableEntry>());
}
}
/// <summary>
@@ -697,7 +697,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
// Put two remote keys in advance.
List<int> rmtKeys = PrimaryKeys(cache2, 2);
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
qry.BufferSize = 2;
qry.TimeInterval = TimeSpan.FromMilliseconds(1000000);
@@ -743,8 +743,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
int key1 = PrimaryKey(cache1);
int key2 = PrimaryKey(cache2);
- ContinuousQuery<int, PortableEntry> qry =
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry =
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
qry.BufferSize = 2;
qry.TimeInterval = TimeSpan.FromMilliseconds(500);
@@ -791,26 +791,26 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
public void TestInitialQuery()
{
// Scan query, GetAll
- TestInitialQuery(new ScanQuery<int, PortableEntry>(new InitialQueryScanFilter()), cur => cur.GetAll());
+ TestInitialQuery(new ScanQuery<int, BinarizableEntry>(new InitialQueryScanFilter()), cur => cur.GetAll());
// Scan query, iterator
- TestInitialQuery(new ScanQuery<int, PortableEntry>(new InitialQueryScanFilter()), cur => cur.ToList());
+ TestInitialQuery(new ScanQuery<int, BinarizableEntry>(new InitialQueryScanFilter()), cur => cur.ToList());
// Sql query, GetAll
- TestInitialQuery(new SqlQuery(typeof(PortableEntry), "val < 33"), cur => cur.GetAll());
+ TestInitialQuery(new SqlQuery(typeof(BinarizableEntry), "val < 33"), cur => cur.GetAll());
// Sql query, iterator
- TestInitialQuery(new SqlQuery(typeof(PortableEntry), "val < 33"), cur => cur.ToList());
+ TestInitialQuery(new SqlQuery(typeof(BinarizableEntry), "val < 33"), cur => cur.ToList());
// Text query, GetAll
- TestInitialQuery(new TextQuery(typeof(PortableEntry), "1*"), cur => cur.GetAll());
+ TestInitialQuery(new TextQuery(typeof(BinarizableEntry), "1*"), cur => cur.GetAll());
// Text query, iterator
- TestInitialQuery(new TextQuery(typeof(PortableEntry), "1*"), cur => cur.ToList());
+ TestInitialQuery(new TextQuery(typeof(BinarizableEntry), "1*"), cur => cur.ToList());
// Test exception: invalid initial query
var ex = Assert.Throws<IgniteException>(
- () => TestInitialQuery(new TextQuery(typeof (PortableEntry), "*"), cur => cur.GetAll()));
+ () => TestInitialQuery(new TextQuery(typeof (BinarizableEntry), "*"), cur => cur.GetAll()));
Assert.AreEqual("Cannot parse '*': '*' or '?' not allowed as first character in WildcardQuery", ex.Message);
}
@@ -818,10 +818,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Tests the initial query.
/// </summary>
- private void TestInitialQuery(QueryBase initialQry, Func<IQueryCursor<ICacheEntry<int, PortableEntry>>,
- IEnumerable<ICacheEntry<int, PortableEntry>>> getAllFunc)
+ private void TestInitialQuery(QueryBase initialQry, Func<IQueryCursor<ICacheEntry<int, BinarizableEntry>>,
+ IEnumerable<ICacheEntry<int, BinarizableEntry>>> getAllFunc)
{
- var qry = new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ var qry = new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
cache1.Put(11, Entry(11));
cache1.Put(12, Entry(12));
@@ -829,7 +829,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
try
{
- IContinuousQueryHandle<ICacheEntry<int, PortableEntry>> contQry;
+ IContinuousQueryHandle<ICacheEntry<int, BinarizableEntry>> contQry;
using (contQry = cache1.QueryContinuous(qry, initialQry))
{
@@ -868,7 +868,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expKey">Expected key.</param>
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected value.</param>
- private void CheckFilterSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal)
+ private void CheckFilterSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal)
{
CheckFilterSingle(expKey, expOldVal, expVal, 1000);
}
@@ -880,7 +880,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected value.</param>
/// <param name="timeout">Timeout.</param>
- private void CheckFilterSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal, int timeout)
+ private void CheckFilterSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal, int timeout)
{
FilterEvent evt;
@@ -908,7 +908,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expKey">Expected key.</param>
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected new value.</param>
- private void CheckCallbackSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal)
+ private void CheckCallbackSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal)
{
CheckCallbackSingle(expKey, expOldVal, expVal, 1000);
}
@@ -920,7 +920,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected new value.</param>
/// <param name="timeout">Timeout.</param>
- private void CheckCallbackSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal, int timeout)
+ private void CheckCallbackSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal, int timeout)
{
CallbackEvent evt;
@@ -949,9 +949,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// </summary>
/// <param name="val">Value.</param>
/// <returns>Entry.</returns>
- private static PortableEntry Entry(int val)
+ private static BinarizableEntry Entry(int val)
{
- return new PortableEntry(val);
+ return new BinarizableEntry(val);
}
/// <summary>
@@ -1010,9 +1010,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Portable entry.
+ /// Binarizable entry.
/// </summary>
- public class PortableEntry
+ public class BinarizableEntry
{
/** Value. */
public readonly int val;
@@ -1027,7 +1027,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// Constructor.
/// </summary>
/// <param name="val">Value.</param>
- public PortableEntry(int val)
+ public BinarizableEntry(int val)
{
this.val = val;
}
@@ -1035,7 +1035,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/** <inheritDoc /> */
public override bool Equals(object obj)
{
- return obj != null && obj is PortableEntry && ((PortableEntry)obj).val == val;
+ return obj != null && obj is BinarizableEntry && ((BinarizableEntry)obj).val == val;
}
}
@@ -1076,15 +1076,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Filter which cannot be serialized.
/// </summary>
- public class LocalFilter : AbstractFilter<PortableEntry>
+ public class LocalFilter : AbstractFilter<BinarizableEntry>
{
// No-op.
}
/// <summary>
- /// Portable filter.
+ /// Binarizable filter.
/// </summary>
- public class PortableFilter : AbstractFilter<PortableEntry>, IBinarizable
+ public class BinarizableFilter : AbstractFilter<BinarizableEntry>, IBinarizable
{
/** <inheritDoc /> */
public void WriteBinary(IBinaryWriter writer)
@@ -1105,7 +1105,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// Serializable filter.
/// </summary>
[Serializable]
- public class SerializableFilter : AbstractFilter<PortableEntry>, ISerializable
+ public class SerializableFilter : AbstractFilter<BinarizableEntry>, ISerializable
{
/// <summary>
/// Constructor.
@@ -1135,9 +1135,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Filter for "keep-portable" scenario.
+ /// Filter for "keep-binary" scenario.
/// </summary>
- public class KeepPortableFilter : AbstractFilter<IBinaryObject>
+ public class KeepBinaryFilter : AbstractFilter<IBinaryObject>
{
// No-op.
}
@@ -1173,7 +1173,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
IBinaryType meta = val.GetBinaryType();
- Assert.AreEqual(typeof(PortableEntry).Name, meta.TypeName);
+ Assert.AreEqual(typeof(BinarizableEntry).Name, meta.TypeName);
}
countDown.Signal();
@@ -1225,10 +1225,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// ScanQuery filter for InitialQuery test.
/// </summary>
[Serializable]
- private class InitialQueryScanFilter : ICacheEntryFilter<int, PortableEntry>
+ private class InitialQueryScanFilter : ICacheEntryFilter<int, BinarizableEntry>
{
/** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, PortableEntry> entry)
+ public bool Invoke(ICacheEntry<int, BinarizableEntry> entry)
{
return entry.Key < 33;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
index aa7d627..1d2f1f2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
@@ -43,10 +43,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter logic.
+ /// Test binary filter logic.
/// </summary>
[Test]
- public void TestFilterPortableLocal()
+ public void TestFilterBinarizableLocal()
{
CheckFilter(true, true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index eb148f0..1270138 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -117,7 +117,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
public class CacheStoreTest
{
/** */
- private const string PortableStoreCacheName = "portable_store";
+ private const string BinaryStoreCacheName = "binary_store";
/** */
private const string ObjectStoreCacheName = "object_store";
@@ -145,7 +145,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
IgniteConfigurationEx cfg = new IgniteConfigurationEx();
- cfg.GridName = GridName();
+ cfg.GridName = GridName;
cfg.JvmClasspath = TestUtils.CreateTestClasspath();
cfg.JvmOptions = TestUtils.TestJavaOptions();
cfg.SpringConfigUrl = "config\\native-client-test-cache-store.xml";
@@ -183,7 +183,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[TearDown]
public void AfterTest()
{
- var cache = Cache();
+ var cache = GetCache();
cache.Clear();
@@ -191,7 +191,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
CacheTestStore.Reset();
- TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName()));
+ TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName));
Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
}
@@ -199,7 +199,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLoadCache()
{
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -220,7 +220,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLocalLoadCache()
{
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -237,7 +237,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
{
CacheTestStore.LoadObjects = true;
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -255,7 +255,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLoadCacheAsync()
{
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -272,7 +272,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestPutLoad()
{
- var cache = Cache();
+ var cache = GetCache();
cache.Put(1, "val");
@@ -290,9 +290,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
[Test]
- public void TestPutLoadPortables()
+ public void TestPutLoadBinarizable()
{
- var cache = PortableStoreCache<int, Value>();
+ var cache = GetBinaryStoreCache<int, Value>();
cache.Put(1, new Value(1));
@@ -316,7 +316,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestPutLoadObjects()
{
- var cache = ObjectStoreCache<int, Value>();
+ var cache = GetObjectStoreCache<int, Value>();
cache.Put(1, new Value(1));
@@ -345,7 +345,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
for (int i = 0; i < 10; i++)
putMap.Add(i, "val_" + i);
- var cache = Cache();
+ var cache = GetCache();
cache.PutAll(putMap);
@@ -378,7 +378,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestRemove()
{
- var cache = Cache();
+ var cache = GetCache();
for (int i = 0; i < 10; i++)
cache.Put(i, "val_" + i);
@@ -399,7 +399,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestRemoveAll()
{
- var cache = Cache();
+ var cache = GetCache();
for (int i = 0; i < 10; i++)
cache.Put(i, "val_" + i);
@@ -419,7 +419,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestTx()
{
- var cache = Cache();
+ var cache = GetCache();
using (var tx = cache.Ignite.GetTransactions().TxStart())
{
@@ -444,7 +444,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
{
CacheTestStore.LoadMultithreaded = true;
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -459,7 +459,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestCustomStoreProperties()
{
- var cache = CustomStoreCache();
+ var cache = GetCustomStoreCache();
Assert.IsNotNull(cache);
Assert.AreEqual(42, CacheTestStore.intProperty);
@@ -469,7 +469,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestDynamicStoreStart()
{
- var cache = TemplateStoreCache();
+ var cache = GetTemplateStoreCache();
Assert.IsNotNull(cache);
@@ -483,10 +483,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Get's grid name for this test.
/// </summary>
- /// <returns>Grid name.</returns>
- protected virtual string GridName()
+ /// <value>Grid name.</value>
+ protected virtual string GridName
{
- return null;
+ get { return null; }
}
private IDictionary StoreMap()
@@ -494,31 +494,31 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
return CacheTestStore.Map;
}
- private ICache<int, string> Cache()
+ private ICache<int, string> GetCache()
{
- return PortableStoreCache<int, string>();
+ return GetBinaryStoreCache<int, string>();
}
- private ICache<TK, TV> PortableStoreCache<TK, TV>()
+ private ICache<TK, TV> GetBinaryStoreCache<TK, TV>()
{
- return Ignition.GetIgnite(GridName()).GetCache<TK, TV>(PortableStoreCacheName);
+ return Ignition.GetIgnite(GridName).GetCache<TK, TV>(BinaryStoreCacheName);
}
- private ICache<TK, TV> ObjectStoreCache<TK, TV>()
+ private ICache<TK, TV> GetObjectStoreCache<TK, TV>()
{
- return Ignition.GetIgnite(GridName()).GetCache<TK, TV>(ObjectStoreCacheName);
+ return Ignition.GetIgnite(GridName).GetCache<TK, TV>(ObjectStoreCacheName);
}
- private ICache<int, string> CustomStoreCache()
+ private ICache<int, string> GetCustomStoreCache()
{
- return Ignition.GetIgnite(GridName()).GetCache<int, string>(CustomStoreCacheName);
+ return Ignition.GetIgnite(GridName).GetCache<int, string>(CustomStoreCacheName);
}
- private ICache<int, string> TemplateStoreCache()
+ private ICache<int, string> GetTemplateStoreCache()
{
var cacheName = TemplateStoreCacheName.Replace("*", Guid.NewGuid().ToString());
- return Ignition.GetIgnite(GridName()).GetOrCreateCache<int, string>(cacheName);
+ return Ignition.GetIgnite(GridName).GetOrCreateCache<int, string>(cacheName);
}
}
@@ -528,9 +528,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
public class NamedNodeCacheStoreTest : CacheStoreTest
{
/** <inheritDoc /> */
- protected override string GridName()
+ protected override string GridName
{
- return "name";
+ get { return "name"; }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
index 9e96ca2..e3d0d96 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
@@ -171,7 +171,7 @@ namespace Apache.Ignite.Core.Tests.Compute
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- PortableTypeConfigurations(portTypeCfgs);
+ GetBinaryTypeConfigurations(portTypeCfgs);
portCfg.TypeConfigurations = portTypeCfgs;
@@ -206,10 +206,10 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Define portable types.
+ /// Define binary types.
/// </summary>
- /// <param name="portTypeCfgs">Portable type configurations.</param>
- protected virtual void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ /// <param name="portTypeCfgs">Binary type configurations.</param>
+ protected virtual void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
new file mode 100644
index 0000000..b881582
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
@@ -0,0 +1,185 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Compute
+{
+ using System;
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Compute;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Closure execution tests for binary objects.
+ /// </summary>
+ public class BinarizableClosureTaskTest : ClosureTaskTest
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public BinarizableClosureTaskTest() : base(false) { }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="fork">Fork flag.</param>
+ protected BinarizableClosureTaskTest(bool fork) : base(fork) { }
+
+ /** <inheritDoc /> */
+ protected override void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ {
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableOutFunc)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFunc)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableException)));
+ }
+
+ /** <inheritDoc /> */
+ protected override IComputeFunc<object> OutFunc(bool err)
+ {
+ return new BinarizableOutFunc(err);
+ }
+
+ /** <inheritDoc /> */
+ protected override IComputeFunc<object, object> Func(bool err)
+ {
+ return new BinarizableFunc(err);
+ }
+
+ /** <inheritDoc /> */
+ protected override void CheckResult(object res)
+ {
+ Assert.IsTrue(res != null);
+
+ BinarizableResult res0 = res as BinarizableResult;
+
+ Assert.IsTrue(res0 != null);
+ Assert.AreEqual(1, res0.Res);
+ }
+
+ /** <inheritDoc /> */
+ protected override void CheckError(Exception err)
+ {
+ Assert.IsTrue(err != null);
+
+ BinarizableException err0 = err as BinarizableException;
+
+ Assert.IsTrue(err0 != null);
+ Assert.AreEqual(ErrMsg, err0.Msg);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableOutFunc : IComputeFunc<object>
+ {
+ /** Error. */
+ private readonly bool _err;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="err"></param>
+ public BinarizableOutFunc(bool err)
+ {
+ _err = err;
+ }
+
+ /** <inheritDoc /> */
+ public object Invoke()
+ {
+ if (_err)
+ throw new BinarizableException(ErrMsg);
+ return new BinarizableResult(1);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableFunc : IComputeFunc<object, object>
+ {
+ /** Error. */
+ private readonly bool _err;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="err"></param>
+ public BinarizableFunc(bool err)
+ {
+ _err = err;
+ }
+
+ /** <inheritDoc /> */
+ public object Invoke(object arg)
+ {
+ if (_err)
+ throw new BinarizableException(ErrMsg);
+ return new BinarizableResult(1);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableException : Exception, IBinarizable
+ {
+ /** */
+ public string Msg;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="msg"></param>
+ public BinarizableException(string msg)
+ {
+ Msg = msg;
+ }
+
+ /** <inheritDoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.GetRawWriter().WriteString(Msg);
+ }
+
+ /** <inheritDoc /> */
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Msg = reader.GetRawReader().ReadString();
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableResult
+ {
+ /** */
+ public readonly int Res;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="res"></param>
+ public BinarizableResult(int res)
+ {
+ Res = res;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs
new file mode 100644
index 0000000..5c1ee34
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs
@@ -0,0 +1,269 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Compute
+{
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Resource;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Task test result.
+ /// </summary>
+ public class BinarizableTaskTest : AbstractTaskTest
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public BinarizableTaskTest() : base(false) { }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="fork">Fork flag.</param>
+ protected BinarizableTaskTest(bool fork) : base(fork) { }
+
+ /// <summary>
+ /// Test for task result.
+ /// </summary>
+ [Test]
+ public void TestBinarizableObjectInTask()
+ {
+ var taskArg = new BinarizableWrapper {Item = ToBinary(Grid1, new BinarizableTaskArgument(100))};
+
+ TestTask task = new TestTask(Grid1, taskArg);
+
+ var res = Grid1.GetCompute().Execute(task, taskArg).Item;
+
+ Assert.NotNull(res);
+
+ Assert.AreEqual(400, res.GetField<int>("val"));
+
+ BinarizableTaskResult resObj = res.Deserialize<BinarizableTaskResult>();
+
+ Assert.AreEqual(400, resObj.Val);
+ }
+
+ private static IBinaryObject ToBinary(IIgnite grid, object obj)
+ {
+ var cache = grid.GetCache<object, object>(Cache1Name).WithKeepBinary<object, object>();
+
+ cache.Put(1, obj);
+
+ return (IBinaryObject) cache.Get(1);
+ }
+
+ /** <inheritDoc /> */
+ override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ {
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJobArgument)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJobResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTaskArgument)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTaskResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJob)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableWrapper)));
+ }
+
+ /// <summary>
+ /// Test task.
+ /// </summary>
+ class TestTask : ComputeTaskAdapter<BinarizableWrapper, BinarizableWrapper, BinarizableWrapper>
+ {
+ /** */
+ private readonly IIgnite _grid;
+
+ private readonly BinarizableWrapper _taskArgField;
+
+ public TestTask(IIgnite grid, BinarizableWrapper taskArgField)
+ {
+ _grid = grid;
+ _taskArgField = taskArgField;
+ }
+
+ /** <inheritDoc /> */
+ override public IDictionary<IComputeJob<BinarizableWrapper>, IClusterNode> Map(IList<IClusterNode> subgrid, BinarizableWrapper arg)
+ {
+ Assert.AreEqual(3, subgrid.Count);
+ Assert.NotNull(_grid);
+
+ var taskArg = arg;
+
+ CheckTaskArgument(taskArg);
+
+ CheckTaskArgument(_taskArgField);
+
+ var jobs = new Dictionary<IComputeJob<BinarizableWrapper>, IClusterNode>();
+
+
+ foreach (IClusterNode node in subgrid)
+ {
+ if (!Grid3Name.Equals(node.GetAttribute<string>("org.apache.ignite.ignite.name"))) // Grid3 does not have cache.
+ {
+ var job = new BinarizableJob
+ {
+ Arg = new BinarizableWrapper {Item = ToBinary(_grid, new BinarizableJobArgument(200))}
+ };
+
+ jobs.Add(job, node);
+ }
+ }
+
+ Assert.AreEqual(2, jobs.Count);
+
+ return jobs;
+ }
+
+ private void CheckTaskArgument(BinarizableWrapper arg)
+ {
+ Assert.IsNotNull(arg);
+
+ var taskArg = arg.Item;
+
+ Assert.IsNotNull(taskArg);
+
+ Assert.AreEqual(100, taskArg.GetField<int>("val"));
+
+ BinarizableTaskArgument taskArgObj = taskArg.Deserialize<BinarizableTaskArgument>();
+
+ Assert.AreEqual(100, taskArgObj.Val);
+ }
+
+ /** <inheritDoc /> */
+ override public BinarizableWrapper Reduce(IList<IComputeJobResult<BinarizableWrapper>> results)
+ {
+ Assert.NotNull(_grid);
+
+ Assert.AreEqual(2, results.Count);
+
+ foreach (var res in results)
+ {
+ var jobRes = res.Data.Item;
+
+ Assert.NotNull(jobRes);
+
+ Assert.AreEqual(300, jobRes.GetField<int>("val"));
+
+ BinarizableJobResult jobResObj = jobRes.Deserialize<BinarizableJobResult>();
+
+ Assert.AreEqual(300, jobResObj.Val);
+ }
+
+ return new BinarizableWrapper {Item = ToBinary(_grid, new BinarizableTaskResult(400))};
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableJobArgument
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableJobArgument(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableJobResult
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableJobResult(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableTaskArgument
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableTaskArgument(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableTaskResult
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableTaskResult(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableJob : IComputeJob<BinarizableWrapper>
+ {
+ [InstanceResource]
+ private readonly IIgnite _grid = null;
+
+ /** */
+ public BinarizableWrapper Arg;
+
+ /** <inheritDoc /> */
+
+ public BinarizableWrapper Execute()
+ {
+ Assert.IsNotNull(Arg);
+
+ var arg = Arg.Item;
+
+ Assert.IsNotNull(arg);
+
+ Assert.AreEqual(200, arg.GetField<int>("val"));
+
+ var argObj = arg.Deserialize<BinarizableJobArgument>();
+
+ Assert.AreEqual(200, argObj.Val);
+
+ return new BinarizableWrapper {Item = ToBinary(_grid, new BinarizableJobResult(300))};
+ }
+
+ public void Cancel()
+ {
+ // No-op.
+ }
+ }
+
+ class BinarizableWrapper
+ {
+ public IBinaryObject Item { get; set; }
+ }
+ }
+}
[14/50] [abbrv] ignite git commit: Fixed typos
Posted by vo...@apache.org.
Fixed typos
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dbadb45a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dbadb45a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dbadb45a
Branch: refs/heads/ignite-1816
Commit: dbadb45a09dd2a8a2e7e153b9862f71419ea5ecc
Parents: 50ede23
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 10 16:01:46 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 10 16:45:07 2015 -0800
----------------------------------------------------------------------
.../ignite/cache/store/CacheStoreSessionListener.java | 9 +++++----
.../cache/store/jdbc/CacheJdbcStoreSessionListener.java | 8 ++++----
2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dbadb45a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSessionListener.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSessionListener.java
index 8215756..9496d20 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSessionListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSessionListener.java
@@ -35,11 +35,12 @@ import org.apache.ignite.configuration.IgniteConfiguration;
* rollback when session is finished.
* <p>
* Cache store session listener allows to implement this and other
- * scenarios providing to callback methods:
+ * scenarios providing two callback methods:
* <ul>
* <li>
* {@link #onSessionStart(CacheStoreSession)} - called
- * before any store operation within a session is invoked.
+ * when a session is created prior to all operations
+ * within his session.
* </li>
* <li>
* {@link #onSessionEnd(CacheStoreSession, boolean)} - called
@@ -47,7 +48,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
* </li>
* </ul>
* <h2>Implementations</h2>
- * Ignites provides several out-of-the-box implementations
+ * Ignite provides several out-of-the-box implementations
* of session listener (refer to individual JavaDocs for more
* details):
* <ul>
@@ -130,4 +131,4 @@ public interface CacheStoreSessionListener {
* should commit, {@code false} for rollback.
*/
public void onSessionEnd(CacheStoreSession ses, boolean commit);
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/dbadb45a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListener.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListener.java
index 2c70d26..6be237e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListener.java
@@ -37,12 +37,12 @@ import org.apache.ignite.lifecycle.LifecycleAware;
* back) it when session ends.
* <p>
* The connection is saved as a store session
- * {@link CacheStoreSession#attachment() attachment}.
+ * {@link CacheStoreSession#attachment() attachment}.
* The listener guarantees that the connection will be
* available for any store operation. If there is an
* ongoing cache transaction, all operations within this
* transaction will be committed or rolled back only when
- * session ends.
+ * the session ends.
* <p>
* As an example, here is how the {@link CacheStore#write(Cache.Entry)}
* method can be implemented if {@link CacheJdbcStoreSessionListener}
@@ -133,11 +133,11 @@ public class CacheJdbcStoreSessionListener implements CacheStoreSessionListener,
conn.rollback();
}
catch (SQLException e) {
- throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
+ throw new CacheWriterException("Failed to end store session [tx=" + ses.transaction() + ']', e);
}
finally {
U.closeQuiet(conn);
}
}
}
-}
\ No newline at end of file
+}
[26/50] [abbrv] ignite git commit: Ignite-1093 Backward compatibility
fix.
Posted by vo...@apache.org.
Ignite-1093 Backward compatibility fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c9cea766
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c9cea766
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c9cea766
Branch: refs/heads/ignite-1816
Commit: c9cea76656fb00c03811350260bd158ffdf8739a
Parents: 7a40364
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 13 14:19:13 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 13 14:19:13 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/preloader/GridDhtPartitionSupplier.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9cea766/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index 865bad8..4e33d8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -759,6 +759,9 @@ class GridDhtPartitionSupplier {
ClusterNode node = cctx.node(id);
+ if (node == null)
+ return;
+
long preloadThrottle = cctx.config().getRebalanceThrottle();
boolean ack = false;
[19/50] [abbrv] ignite git commit: IGNITE-1681: loadAll threshold is
not configurable for CacheStoreBalancingWrapper
Posted by vo...@apache.org.
IGNITE-1681: loadAll threshold is not configurable for CacheStoreBalancingWrapper
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/967cfcbb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/967cfcbb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/967cfcbb
Branch: refs/heads/ignite-1816
Commit: 967cfcbb5b87e172a48e619b18e3988f4ef2e428
Parents: 92881e0
Author: Michael Griggs <en...@gmail.com>
Authored: Wed Nov 11 13:45:48 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 11 13:45:48 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 37 ++++++++++++++
.../cache/CacheStoreBalancingWrapper.java | 5 +-
.../store/GridCacheStoreManagerAdapter.java | 3 +-
.../store/GridCacheBalancingStoreSelfTest.java | 53 +++++++++++++++++---
4 files changed, 88 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/967cfcbb/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 b7276c9..1b8d41c 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
@@ -174,9 +174,15 @@ 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 threshold for concurrent loading of keys from {@link CacheStore}. */
+ public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5;
+
/** Cache name. */
private String name;
+ /** Threshold for concurrent loading of keys from {@link CacheStore}. */
+ private int storeConcurrentLoadAllThreshold = DFLT_CONCURRENT_LOAD_ALL_THRESHOLD;
+
/** Rebalance thread pool size. */
@Deprecated
private int rebalancePoolSize = DFLT_REBALANCE_THREAD_POOL_SIZE;
@@ -834,6 +840,37 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Gets the threshold used in cases when values for multiple keys are being loaded from an underlying
+ * {@link CacheStore} in parallel. In the situation when several threads load the same or intersecting set of keys
+ * and the total number of keys to load is less or equal to this threshold then there will be no a second call to
+ * the storage in order to load a key from thread A if the same key is already being loaded by thread B.
+ *
+ * The threshold should be controlled wisely. On the one hand if it's set to a big value then the interaction with
+ * a storage during the load of missing keys will be minimal. On the other hand the big value may result in
+ * significant performance degradation because it is needed to check for every key whether it's being loaded or not.
+ *
+ * When not set, default value is {@link #DFLT_CONCURRENT_LOAD_ALL_THRESHOLD}.
+ *
+ * @return The concurrent load-all threshold.
+ */
+ public int getStoreConcurrentLoadAllThreshold() {
+ return storeConcurrentLoadAllThreshold;
+ }
+
+ /**
+ * Sets the concurrent load-all threshold used for cases when keys' values are being loaded from {@link CacheStore}
+ * in parallel.
+ *
+ * @param storeConcurrentLoadAllThreshold The concurrent load-all threshold.
+ * @return {@code this} for chaining.
+ */
+ public CacheConfiguration<K, V> setStoreConcurrentLoadAllThreshold(int storeConcurrentLoadAllThreshold) {
+ this.storeConcurrentLoadAllThreshold = storeConcurrentLoadAllThreshold;
+
+ return this;
+ }
+
+ /**
* Gets key topology resolver to provide mapping from keys to nodes.
*
* @return Key topology resolver to provide mapping from keys to nodes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/967cfcbb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
index 93075f3..8992326 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
@@ -28,6 +28,7 @@ import javax.cache.integration.CacheLoaderException;
import javax.cache.integration.CacheWriterException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteBiInClosure;
@@ -39,7 +40,7 @@ import org.jsr166.ConcurrentHashMap8;
*/
public class CacheStoreBalancingWrapper<K, V> implements CacheStore<K, V> {
/** */
- public static final int DFLT_LOAD_ALL_THRESHOLD = 5;
+ public static final int DFLT_LOAD_ALL_THRESHOLD = CacheConfiguration.DFLT_CONCURRENT_LOAD_ALL_THRESHOLD;
/** Delegate store. */
private CacheStore<K, V> delegate;
@@ -306,4 +307,4 @@ public class CacheStoreBalancingWrapper<K, V> implements CacheStore<K, V> {
return get().get(key);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/967cfcbb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index dd54da5..6bfafd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -112,7 +112,8 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
store = cacheStoreWrapper(ctx, cfgStore, cfg);
- singleThreadGate = store == null ? null : new CacheStoreBalancingWrapper<>(store);
+ singleThreadGate = store == null ? null : new CacheStoreBalancingWrapper<>(store,
+ cfg.getStoreConcurrentLoadAllThreshold());
ThreadLocal<SessionData> sesHolder0 = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/967cfcbb/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
index 1e3e4b4..bfbb08c 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.cache.Cache;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.cache.CacheStoreBalancingWrapper;
@@ -127,15 +128,35 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testConcurrentLoad() throws Exception {
- int threads = 5;
+ CacheConfiguration cfg = new CacheConfiguration();
- final int keys = 50;
+ assertEquals(CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD, cfg.getStoreConcurrentLoadAllThreshold());
+ doTestConcurrentLoad(5, 50, CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentLoadCustomThreshold() throws Exception {
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setStoreConcurrentLoadAllThreshold(15);
+
+ assertEquals(15, cfg.getStoreConcurrentLoadAllThreshold());
+
+ doTestConcurrentLoad(5, 50, cfg.getStoreConcurrentLoadAllThreshold());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void doTestConcurrentLoad(int threads, final int keys, int threshold) throws Exception {
final CyclicBarrier beforeBarrier = new CyclicBarrier(threads);
ConcurrentVerifyStore store = new ConcurrentVerifyStore(keys);
- final CacheStoreBalancingWrapper<Integer, Integer> wrapper =new CacheStoreBalancingWrapper<>(store);
+ final CacheStoreBalancingWrapper<Integer, Integer> wrapper = new CacheStoreBalancingWrapper<>(store, threshold);
GridTestUtils.runMultiThreaded(new Runnable() {
@Override public void run() {
@@ -159,17 +180,35 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testConcurrentLoadAll() throws Exception {
- int threads = 5;
+ CacheConfiguration cfg = new CacheConfiguration();
- final int threshold = 5;
+ assertEquals(CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD, cfg.getStoreConcurrentLoadAllThreshold());
- final int keysCnt = 100;
+ doTestConcurrentLoadAll(5, CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD, 150);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentLoadAllCustomThreshold() throws Exception {
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setStoreConcurrentLoadAllThreshold(15);
+ assertEquals(15, cfg.getStoreConcurrentLoadAllThreshold());
+
+ doTestConcurrentLoadAll(5, cfg.getStoreConcurrentLoadAllThreshold(), 150);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void doTestConcurrentLoadAll(int threads, final int threshold, final int keysCnt) throws Exception {
final CyclicBarrier beforeBarrier = new CyclicBarrier(threads);
ConcurrentVerifyStore store = new ConcurrentVerifyStore(keysCnt);
- final CacheStoreBalancingWrapper<Integer, Integer> wrapper = new CacheStoreBalancingWrapper<>(store);
+ final CacheStoreBalancingWrapper<Integer, Integer> wrapper = new CacheStoreBalancingWrapper<>(store, threshold);
GridTestUtils.runMultiThreaded(new Runnable() {
@Override public void run() {
[37/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs
deleted file mode 100644
index 16c68e1..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/PortableConfigurationTest.cs
+++ /dev/null
@@ -1,173 +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.
- */
-
-namespace Apache.Ignite.Core.Tests
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Cache;
- using NUnit.Framework;
-
- /// <summary>
- /// Portable configuration tests.
- /// </summary>
- public class PortableConfigurationTest
- {
- /** Cache. */
- private ICache<int, TestGenericPortableBase> _cache;
-
- /** Random generator. */
- private static readonly Random Rnd = new Random();
-
- /** Test types for code config */
- private static readonly Type[] TestTypes = {
- typeof (TestGenericPortable<int>),
- typeof (TestGenericPortable<string>),
- typeof (TestGenericPortable<TestGenericPortable<int>>),
- typeof (TestGenericPortable<List<Tuple<int, string>>>),
- typeof (TestGenericPortable<int, string>),
- typeof (TestGenericPortable<int, TestGenericPortable<string>>),
- typeof (TestGenericPortable<int, string, Type>),
- typeof (TestGenericPortable<int, string, TestGenericPortable<int, string, Type>>)
- };
-
- /** Test types for xml config */
- private static readonly Type[] TestTypesXml = {
- typeof (TestGenericPortable<long>),
- typeof (TestGenericPortable<Type>),
- typeof (TestGenericPortable<TestGenericPortable<long>>),
- typeof (TestGenericPortable<List<Tuple<long, string>>>),
- typeof (TestGenericPortable<long, string>),
- typeof (TestGenericPortable<long, TestGenericPortable<string>>),
- typeof (TestGenericPortable<long, string, Type>),
- typeof (TestGenericPortable<long, string, TestGenericPortable<long, string, Type>>)
- };
-
- /// <summary>
- /// Starts the grid with provided config.
- /// </summary>
- /// <param name="binaryConfiguration">The portable configuration.</param>
- private void StartGrid(BinaryConfiguration binaryConfiguration)
- {
- Ignition.StopAll(true);
-
- var grid = Ignition.Start(new IgniteConfiguration
- {
- SpringConfigUrl = "config\\cache-portables.xml",
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- BinaryConfiguration = binaryConfiguration
- });
-
- _cache = grid.GetCache<int, TestGenericPortableBase>(null);
- }
-
- /// <summary>
- /// Test fixture tear-down routine.
- /// </summary>
- [TestFixtureTearDown]
- public void TestFixtureTearDown()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- /// Tests the configuration set in code.
- /// </summary>
- [Test]
- public void TestCodeConfiguration()
- {
- StartGrid(new BinaryConfiguration
- {
- TypeConfigurations = TestTypes.Select(x => new BinaryTypeConfiguration(x)).ToList()
- });
-
- CheckPortableTypes(TestTypes);
- }
-
- /// <summary>
- /// Tests the configuration set in xml.
- /// </summary>
- [Test]
- public void TestXmlConfiguration()
- {
- StartGrid(null);
-
- CheckPortableTypes(TestTypesXml);
- }
-
- /// <summary>
- /// Checks that specified types are portable and can be successfully used in cache.
- /// </summary>
- private void CheckPortableTypes(IEnumerable<Type> testTypes)
- {
- int key = 0;
-
- foreach (var typ in testTypes)
- {
- key += 1;
-
- var inst = CreateInstance(typ);
-
- _cache.Put(key, inst);
-
- var result = _cache.Get(key);
-
- Assert.AreEqual(inst.Prop, result.Prop);
-
- Assert.AreEqual(typ, result.GetType());
- }
- }
-
- /// <summary>
- /// Creates the instance of specified test portable type and sets a value on it.
- /// </summary>
- private static TestGenericPortableBase CreateInstance(Type type)
- {
- var inst = (TestGenericPortableBase)Activator.CreateInstance(type);
-
- inst.Prop = Rnd.Next(int.MaxValue);
-
- return inst;
- }
- }
-
- public abstract class TestGenericPortableBase
- {
- public object Prop { get; set; }
- }
-
- public class TestGenericPortable<T> : TestGenericPortableBase
- {
- public T Prop1 { get; set; }
- }
-
- public class TestGenericPortable<T1, T2> : TestGenericPortableBase
- {
- public T1 Prop1 { get; set; }
- public T2 Prop2 { get; set; }
- }
-
- public class TestGenericPortable<T1, T2, T3> : TestGenericPortableBase
- {
- public T1 Prop1 { get; set; }
- public T2 Prop2 { get; set; }
- public T3 Prop3 { get; set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/BinarizablePerson.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/BinarizablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/BinarizablePerson.cs
new file mode 100644
index 0000000..c2e38bb
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/BinarizablePerson.cs
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Query
+{
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Test person.
+ /// </summary>
+ internal class BinarizablePerson : IBinarizable
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinarizablePerson"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="age">The age.</param>
+ public BinarizablePerson(string name, int age)
+ {
+ Name = name;
+ Age = age;
+ }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the address.
+ /// </summary>
+ public string Address { get; set; }
+
+ /// <summary>
+ /// Gets or sets the age.
+ /// </summary>
+ public int Age { get; set; }
+
+ /** <ineritdoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteString("name", Name);
+ writer.WriteString("address", Address);
+ writer.WriteInt("age", Age);
+ }
+
+ /** <ineritdoc /> */
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Name = reader.ReadString("name");
+ Address = reader.ReadString("address");
+ Age = reader.ReadInt("age");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitBinarizablePerson.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitBinarizablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitBinarizablePerson.cs
new file mode 100644
index 0000000..b7e9524
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitBinarizablePerson.cs
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Query
+{
+ /// <summary>
+ /// Test person.
+ /// </summary>
+ internal class ImplicitBinarizablePerson
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImplicitBinarizablePerson"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="age">The age.</param>
+ public ImplicitBinarizablePerson(string name, int age)
+ {
+ Name = name;
+ Age = age;
+ }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the age.
+ /// </summary>
+ public int Age { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitPortablePerson.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitPortablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitPortablePerson.cs
deleted file mode 100644
index f80c4eb..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/ImplicitPortablePerson.cs
+++ /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.
- */
-
-namespace Apache.Ignite.Core.Tests.Query
-{
- /// <summary>
- /// Test person.
- /// </summary>
- internal class ImplicitPortablePerson
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ImplicitPortablePerson"/> class.
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="age">The age.</param>
- public ImplicitPortablePerson(string name, int age)
- {
- Name = name;
- Age = age;
- }
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the age.
- /// </summary>
- public int Age { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefBinarizablePerson.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefBinarizablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefBinarizablePerson.cs
new file mode 100644
index 0000000..5ae4159
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefBinarizablePerson.cs
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Query
+{
+ /// <summary>
+ /// Test person.
+ /// </summary>
+ internal class NoDefBinarizablePerson
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the age.
+ /// </summary>
+ public int Age { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefPortablePerson.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefPortablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefPortablePerson.cs
deleted file mode 100644
index 16bd07d..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/NoDefPortablePerson.cs
+++ /dev/null
@@ -1,35 +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.
- */
-
-namespace Apache.Ignite.Core.Tests.Query
-{
- /// <summary>
- /// Test person.
- /// </summary>
- internal class NoDefPortablePerson
- {
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the age.
- /// </summary>
- public int Age { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs
deleted file mode 100644
index 08134fd..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Query/PortablePerson.cs
+++ /dev/null
@@ -1,69 +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.
- */
-
-namespace Apache.Ignite.Core.Tests.Query
-{
- using Apache.Ignite.Core.Binary;
-
- /// <summary>
- /// Test person.
- /// </summary>
- internal class PortablePerson : IBinarizable
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="PortablePerson"/> class.
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="age">The age.</param>
- public PortablePerson(string name, int age)
- {
- Name = name;
- Age = age;
- }
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the address.
- /// </summary>
- public string Address { get; set; }
-
- /// <summary>
- /// Gets or sets the age.
- /// </summary>
- public int Age { get; set; }
-
- /** <ineritdoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteString("name", Name);
- writer.WriteString("address", Address);
- writer.WriteInt("age", Age);
- }
-
- /** <ineritdoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- Name = reader.ReadString("name");
- Address = reader.ReadString("address");
- Age = reader.ReadInt("age");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
index 1fe6a21..1797337 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
@@ -42,8 +42,8 @@ namespace Apache.Ignite.Core.Tests.Services
{
TypeConfigurations = new[]
{
- new BinaryTypeConfiguration(typeof (TestPortableClass)),
- new BinaryTypeConfiguration(typeof (CustomExceptionPortable))
+ new BinaryTypeConfiguration(typeof (TestBinarizableClass)),
+ new BinaryTypeConfiguration(typeof (CustomExceptionBinarizable))
}
});
@@ -54,10 +54,10 @@ namespace Apache.Ignite.Core.Tests.Services
private readonly PlatformMemoryManager _memory = new PlatformMemoryManager(1024);
/** */
- protected bool KeepPortable;
+ protected bool KeepBinary;
/** */
- protected bool SrvKeepPortable;
+ protected bool SrvKeepBinary;
/// <summary>
/// Initializes a new instance of the <see cref="ServiceProxyTest"/> class.
@@ -196,13 +196,13 @@ namespace Apache.Ignite.Core.Tests.Services
}
[Test]
- public void TestPortableMarshallingException()
+ public void TestBinarizableMarshallingException()
{
var prx = GetProxy();
- var ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionPortableMethod(false, false));
+ var ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionBinarizableMethod(false, false));
- if (KeepPortable)
+ if (KeepBinary)
{
Assert.AreEqual("Proxy method invocation failed with a binary error. " +
"Examine BinaryCause for details.", ex.Message);
@@ -219,15 +219,15 @@ namespace Apache.Ignite.Core.Tests.Services
Assert.IsNotNull(ex.InnerException);
}
- ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionPortableMethod(true, false));
+ ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionBinarizableMethod(true, false));
Assert.IsTrue(ex.ToString().Contains(
- "Call completed with error, but error serialization failed [errType=CustomExceptionPortable, " +
- "serializationErrMsg=Expected exception in CustomExceptionPortable.WritePortable]"));
+ "Call completed with error, but error serialization failed [errType=CustomExceptionBinarizable, " +
+ "serializationErrMsg=Expected exception in CustomExceptionBinarizable.WriteBinary]"));
- ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionPortableMethod(true, true));
+ ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionBinarizableMethod(true, true));
Assert.IsTrue(ex.ToString().Contains(
- "Call completed with error, but error serialization failed [errType=CustomExceptionPortable, " +
- "serializationErrMsg=Expected exception in CustomExceptionPortable.WritePortable]"));
+ "Call completed with error, but error serialization failed [errType=CustomExceptionBinarizable, " +
+ "serializationErrMsg=Expected exception in CustomExceptionBinarizable.WriteBinary]"));
}
/// <summary>
@@ -266,7 +266,7 @@ namespace Apache.Ignite.Core.Tests.Services
using (var outStream = new PlatformMemoryStream(_memory.Allocate()))
{
// 1) Write to a stream
- inStream.WriteBool(SrvKeepPortable); // WriteProxyMethod does not do this, but Java does
+ inStream.WriteBool(SrvKeepBinary); // WriteProxyMethod does not do this, but Java does
ServiceProxySerializer.WriteProxyMethod(_marsh.StartMarshal(inStream), method, args);
@@ -290,7 +290,7 @@ namespace Apache.Ignite.Core.Tests.Services
outStream.Seek(0, SeekOrigin.Begin);
- return ServiceProxySerializer.ReadInvocationResult(outStream, _marsh, KeepPortable);
+ return ServiceProxySerializer.ReadInvocationResult(outStream, _marsh, KeepBinary);
}
}
@@ -354,16 +354,16 @@ namespace Apache.Ignite.Core.Tests.Services
void CustomExceptionMethod();
/** */
- void CustomExceptionPortableMethod(bool throwOnWrite, bool throwOnRead);
+ void CustomExceptionBinarizableMethod(bool throwOnWrite, bool throwOnRead);
/** */
- TestPortableClass PortableArgMethod(int arg1, IBinaryObject arg2);
+ TestBinarizableClass BinarizableArgMethod(int arg1, IBinaryObject arg2);
/** */
- IBinaryObject PortableResultMethod(int arg1, TestPortableClass arg2);
+ IBinaryObject BinarizableResultMethod(int arg1, TestBinarizableClass arg2);
/** */
- IBinaryObject PortableArgAndResultMethod(int arg1, IBinaryObject arg2);
+ IBinaryObject BinarizableArgAndResultMethod(int arg1, IBinaryObject arg2);
/** */
int AmbiguousMethod(int arg);
@@ -414,16 +414,16 @@ namespace Apache.Ignite.Core.Tests.Services
void CustomExceptionMethod();
/** */
- void CustomExceptionPortableMethod(bool throwOnWrite, bool throwOnRead);
+ void CustomExceptionBinarizableMethod(bool throwOnWrite, bool throwOnRead);
/** */
- TestPortableClass PortableArgMethod(int arg1, IBinaryObject arg2);
+ TestBinarizableClass BinarizableArgMethod(int arg1, IBinaryObject arg2);
/** */
- IBinaryObject PortableResultMethod(int arg1, TestPortableClass arg2);
+ IBinaryObject BinarizableResultMethod(int arg1, TestBinarizableClass arg2);
/** */
- IBinaryObject PortableArgAndResultMethod(int arg1, IBinaryObject arg2);
+ IBinaryObject BinarizableArgAndResultMethod(int arg1, IBinaryObject arg2);
/** */
void MissingMethod();
@@ -444,7 +444,7 @@ namespace Apache.Ignite.Core.Tests.Services
/// <summary>
/// Initializes a new instance of the <see cref="TestIgniteService"/> class.
/// </summary>
- /// <param name="igniteBinary">The portables.</param>
+ /// <param name="igniteBinary">Binary.</param>
public TestIgniteService(IIgniteBinary igniteBinary)
{
_igniteBinary = igniteBinary;
@@ -520,27 +520,27 @@ namespace Apache.Ignite.Core.Tests.Services
}
/** <inheritdoc /> */
- public void CustomExceptionPortableMethod(bool throwOnWrite, bool throwOnRead)
+ public void CustomExceptionBinarizableMethod(bool throwOnWrite, bool throwOnRead)
{
- throw new CustomExceptionPortable {ThrowOnRead = throwOnRead, ThrowOnWrite = throwOnWrite};
+ throw new CustomExceptionBinarizable {ThrowOnRead = throwOnRead, ThrowOnWrite = throwOnWrite};
}
/** <inheritdoc /> */
- public TestPortableClass PortableArgMethod(int arg1, IBinaryObject arg2)
+ public TestBinarizableClass BinarizableArgMethod(int arg1, IBinaryObject arg2)
{
- return arg2.Deserialize<TestPortableClass>();
+ return arg2.Deserialize<TestBinarizableClass>();
}
/** <inheritdoc /> */
- public IBinaryObject PortableResultMethod(int arg1, TestPortableClass arg2)
+ public IBinaryObject BinarizableResultMethod(int arg1, TestBinarizableClass arg2)
{
return _igniteBinary.ToBinary<IBinaryObject>(arg2);
}
/** <inheritdoc /> */
- public IBinaryObject PortableArgAndResultMethod(int arg1, IBinaryObject arg2)
+ public IBinaryObject BinarizableArgAndResultMethod(int arg1, IBinaryObject arg2)
{
- return _igniteBinary.ToBinary<IBinaryObject>(arg2.Deserialize<TestPortableClass>());
+ return _igniteBinary.ToBinary<IBinaryObject>(arg2.Deserialize<TestBinarizableClass>());
}
/** <inheritdoc /> */
@@ -595,7 +595,7 @@ namespace Apache.Ignite.Core.Tests.Services
/// <summary>
/// Custom non-serializable exception.
/// </summary>
- private class CustomExceptionPortable : Exception, IBinarizable
+ private class CustomExceptionBinarizable : Exception, IBinarizable
{
/** */
public bool ThrowOnWrite { get; set; }
@@ -609,7 +609,7 @@ namespace Apache.Ignite.Core.Tests.Services
writer.WriteBoolean("ThrowOnRead", ThrowOnRead);
if (ThrowOnWrite)
- throw new Exception("Expected exception in CustomExceptionPortable.WritePortable");
+ throw new Exception("Expected exception in CustomExceptionBinarizable.WriteBinary");
}
/** <inheritdoc /> */
@@ -618,14 +618,14 @@ namespace Apache.Ignite.Core.Tests.Services
ThrowOnRead = reader.ReadBoolean("ThrowOnRead");
if (ThrowOnRead)
- throw new Exception("Expected exception in CustomExceptionPortable.ReadPortable");
+ throw new Exception("Expected exception in CustomExceptionBinarizable.ReadBinary");
}
}
/// <summary>
- /// Portable object for method argument/result.
+ /// Binarizable object for method argument/result.
/// </summary>
- protected class TestPortableClass : IBinarizable
+ protected class TestBinarizableClass : IBinarizable
{
/** */
public string Prop { get; set; }
@@ -643,7 +643,7 @@ namespace Apache.Ignite.Core.Tests.Services
writer.WriteBoolean("ThrowOnRead", ThrowOnRead);
if (ThrowOnWrite)
- throw new Exception("Expected exception in TestPortableClass.WritePortable");
+ throw new Exception("Expected exception in TestBinarizableClass.WriteBinary");
}
/** <inheritdoc /> */
@@ -653,89 +653,89 @@ namespace Apache.Ignite.Core.Tests.Services
ThrowOnRead = reader.ReadBoolean("ThrowOnRead");
if (ThrowOnRead)
- throw new Exception("Expected exception in TestPortableClass.ReadPortable");
+ throw new Exception("Expected exception in TestBinarizableClass.ReadBinary");
}
}
}
/// <summary>
- /// Tests <see cref="ServiceProxySerializer"/> functionality with keepPortable mode enabled on client.
+ /// Tests <see cref="ServiceProxySerializer"/> functionality with keepBinary mode enabled on client.
/// </summary>
- public class ServiceProxyTestKeepPortableClient : ServiceProxyTest
+ public class ServiceProxyTestKeepBinaryClient : ServiceProxyTest
{
/// <summary>
- /// Initializes a new instance of the <see cref="ServiceProxyTestKeepPortableClient"/> class.
+ /// Initializes a new instance of the <see cref="ServiceProxyTestKeepBinaryClient"/> class.
/// </summary>
- public ServiceProxyTestKeepPortableClient()
+ public ServiceProxyTestKeepBinaryClient()
{
- KeepPortable = true;
+ KeepBinary = true;
}
[Test]
- public void TestPortableMethods()
+ public void TestBinarizableMethods()
{
var prx = GetProxy();
- var obj = new TestPortableClass { Prop = "PropValue" };
+ var obj = new TestBinarizableClass { Prop = "PropValue" };
- var result = prx.PortableResultMethod(1, obj);
+ var result = prx.BinarizableResultMethod(1, obj);
- Assert.AreEqual(obj.Prop, result.Deserialize<TestPortableClass>().Prop);
+ Assert.AreEqual(obj.Prop, result.Deserialize<TestBinarizableClass>().Prop);
}
}
/// <summary>
- /// Tests <see cref="ServiceProxySerializer"/> functionality with keepPortable mode enabled on server.
+ /// Tests <see cref="ServiceProxySerializer"/> functionality with keepBinary mode enabled on server.
/// </summary>
- public class ServiceProxyTestKeepPortableServer : ServiceProxyTest
+ public class ServiceProxyTestKeepBinaryServer : ServiceProxyTest
{
/// <summary>
- /// Initializes a new instance of the <see cref="ServiceProxyTestKeepPortableServer"/> class.
+ /// Initializes a new instance of the <see cref="ServiceProxyTestKeepBinaryServer"/> class.
/// </summary>
- public ServiceProxyTestKeepPortableServer()
+ public ServiceProxyTestKeepBinaryServer()
{
- SrvKeepPortable = true;
+ SrvKeepBinary = true;
}
[Test]
- public void TestPortableMethods()
+ public void TestBinarizableMethods()
{
var prx = GetProxy();
- var obj = new TestPortableClass { Prop = "PropValue" };
+ var obj = new TestBinarizableClass { Prop = "PropValue" };
var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj);
- var result = prx.PortableArgMethod(1, portObj);
+ var result = prx.BinarizableArgMethod(1, portObj);
Assert.AreEqual(obj.Prop, result.Prop);
}
}
/// <summary>
- /// Tests <see cref="ServiceProxySerializer"/> functionality with keepPortable mode enabled on client and on server.
+ /// Tests <see cref="ServiceProxySerializer"/> functionality with keepBinary mode enabled on client and on server.
/// </summary>
- public class ServiceProxyTestKeepPortableClientServer : ServiceProxyTest
+ public class ServiceProxyTestKeepBinaryClientServer : ServiceProxyTest
{
/// <summary>
- /// Initializes a new instance of the <see cref="ServiceProxyTestKeepPortableClientServer"/> class.
+ /// Initializes a new instance of the <see cref="ServiceProxyTestKeepBinaryClientServer"/> class.
/// </summary>
- public ServiceProxyTestKeepPortableClientServer()
+ public ServiceProxyTestKeepBinaryClientServer()
{
- KeepPortable = true;
- SrvKeepPortable = true;
+ KeepBinary = true;
+ SrvKeepBinary = true;
}
[Test]
- public void TestPortableMethods()
+ public void TestBinarizableMethods()
{
var prx = GetProxy();
- var obj = new TestPortableClass { Prop = "PropValue" };
+ var obj = new TestBinarizableClass { Prop = "PropValue" };
var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj);
- var result = prx.PortableArgAndResultMethod(1, portObj);
+ var result = prx.BinarizableArgAndResultMethod(1, portObj);
- Assert.AreEqual(obj.Prop, result.Deserialize<TestPortableClass>().Prop);
+ Assert.AreEqual(obj.Prop, result.Deserialize<TestBinarizableClass>().Prop);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
index c4b5776..33f255e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
@@ -102,7 +102,7 @@ namespace Apache.Ignite.Core.Tests.Services
/// Tests deployment.
/// </summary>
[Test]
- public void TestDeploy([Values(true, false)] bool portable)
+ public void TestDeploy([Values(true, false)] bool binarizable)
{
var cfg = new ServiceConfiguration
{
@@ -110,7 +110,7 @@ namespace Apache.Ignite.Core.Tests.Services
MaxPerNodeCount = 3,
TotalCount = 3,
NodeFilter = new NodeFilter {NodeId = Grid1.GetCluster().GetLocalNode().Id},
- Service = portable ? new TestIgniteServicePortable() : new TestIgniteServiceSerializable()
+ Service = binarizable ? new TestIgniteServiceBinarizable() : new TestIgniteServiceSerializable()
};
Services.Deploy(cfg);
@@ -161,7 +161,7 @@ namespace Apache.Ignite.Core.Tests.Services
[Test]
public void TestDeployKeyAffinitySingleton()
{
- var svc = new TestIgniteServicePortable();
+ var svc = new TestIgniteServiceBinarizable();
Services.DeployKeyAffinitySingleton(SvcName, svc, CacheName, AffKey);
@@ -176,13 +176,13 @@ namespace Apache.Ignite.Core.Tests.Services
/// Tests key affinity singleton deployment.
/// </summary>
[Test]
- public void TestDeployKeyAffinitySingletonPortable()
+ public void TestDeployKeyAffinitySingletonBinarizable()
{
var services = Services.WithKeepBinary();
- var svc = new TestIgniteServicePortable();
+ var svc = new TestIgniteServiceBinarizable();
- var affKey = new PortableObject {Val = AffKey};
+ var affKey = new BinarizableObject {Val = AffKey};
services.DeployKeyAffinitySingleton(SvcName, svc, CacheName, affKey);
@@ -213,7 +213,7 @@ namespace Apache.Ignite.Core.Tests.Services
{
for (var i = 0; i < 10; i++)
{
- Services.DeployNodeSingleton(SvcName + i, new TestIgniteServicePortable());
+ Services.DeployNodeSingleton(SvcName + i, new TestIgniteServiceBinarizable());
Assert.IsNotNull(Services.GetService<ITestIgniteService>(SvcName + i));
}
@@ -236,7 +236,7 @@ namespace Apache.Ignite.Core.Tests.Services
/// Tests service proxy.
/// </summary>
[Test]
- public void TestGetServiceProxy([Values(true, false)] bool portable)
+ public void TestGetServiceProxy([Values(true, false)] bool binarizable)
{
// Test proxy without a service
var prx = Services.GetServiceProxy<ITestIgniteService>(SvcName);
@@ -247,8 +247,8 @@ namespace Apache.Ignite.Core.Tests.Services
Assert.AreEqual("Failed to find deployed service: " + SvcName, ex.Message);
// Deploy to grid2 & grid3
- var svc = portable
- ? new TestIgniteServicePortable {TestProperty = 17}
+ var svc = binarizable
+ ? new TestIgniteServiceBinarizable {TestProperty = 17}
: new TestIgniteServiceSerializable {TestProperty = 17};
Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id, Grid3.GetCluster().GetLocalNode().Id).GetServices()
@@ -300,7 +300,7 @@ namespace Apache.Ignite.Core.Tests.Services
[Test]
public void TestDuckTyping([Values(true, false)] bool local)
{
- var svc = new TestIgniteServicePortable {TestProperty = 33};
+ var svc = new TestIgniteServiceBinarizable {TestProperty = 33};
// Deploy locally or to the remote node
var nodeId = (local ? Grid1 : Grid2).GetCluster().GetLocalNode().Id;
@@ -358,12 +358,12 @@ namespace Apache.Ignite.Core.Tests.Services
}
/// <summary>
- /// Tests the client portable flag.
+ /// Tests the client binary flag.
/// </summary>
[Test]
- public void TestWithKeepPortableClient()
+ public void TestWithKeepBinaryClient()
{
- var svc = new TestIgniteServicePortable();
+ var svc = new TestIgniteServiceBinarizable();
// Deploy to grid2
Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithKeepBinary()
@@ -372,22 +372,22 @@ namespace Apache.Ignite.Core.Tests.Services
// Get proxy
var prx = Services.WithKeepBinary().GetServiceProxy<ITestIgniteService>(SvcName);
- var obj = new PortableObject {Val = 11};
+ var obj = new BinarizableObject {Val = 11};
var res = (IBinaryObject) prx.Method(obj);
- Assert.AreEqual(11, res.Deserialize<PortableObject>().Val);
+ Assert.AreEqual(11, res.Deserialize<BinarizableObject>().Val);
res = (IBinaryObject) prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj));
- Assert.AreEqual(11, res.Deserialize<PortableObject>().Val);
+ Assert.AreEqual(11, res.Deserialize<BinarizableObject>().Val);
}
/// <summary>
- /// Tests the server portable flag.
+ /// Tests the server binary flag.
/// </summary>
[Test]
- public void TestWithKeepPortableServer()
+ public void TestWithKeepBinaryServer()
{
- var svc = new TestIgniteServicePortable();
+ var svc = new TestIgniteServiceBinarizable();
// Deploy to grid2
Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithServerKeepBinary()
@@ -396,22 +396,22 @@ namespace Apache.Ignite.Core.Tests.Services
// Get proxy
var prx = Services.WithServerKeepBinary().GetServiceProxy<ITestIgniteService>(SvcName);
- var obj = new PortableObject { Val = 11 };
+ var obj = new BinarizableObject { Val = 11 };
- var res = (PortableObject) prx.Method(obj);
+ var res = (BinarizableObject) prx.Method(obj);
Assert.AreEqual(11, res.Val);
- res = (PortableObject)prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj));
+ res = (BinarizableObject)prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj));
Assert.AreEqual(11, res.Val);
}
/// <summary>
- /// Tests server and client portable flag.
+ /// Tests server and client binary flag.
/// </summary>
[Test]
- public void TestWithKeepPortableBoth()
+ public void TestWithKeepBinaryBoth()
{
- var svc = new TestIgniteServicePortable();
+ var svc = new TestIgniteServiceBinarizable();
// Deploy to grid2
Grid1.GetCluster().ForNodeIds(Grid2.GetCluster().GetLocalNode().Id).GetServices().WithKeepBinary().WithServerKeepBinary()
@@ -420,13 +420,13 @@ namespace Apache.Ignite.Core.Tests.Services
// Get proxy
var prx = Services.WithKeepBinary().WithServerKeepBinary().GetServiceProxy<ITestIgniteService>(SvcName);
- var obj = new PortableObject { Val = 11 };
+ var obj = new BinarizableObject { Val = 11 };
var res = (IBinaryObject)prx.Method(obj);
- Assert.AreEqual(11, res.Deserialize<PortableObject>().Val);
+ Assert.AreEqual(11, res.Deserialize<BinarizableObject>().Val);
res = (IBinaryObject)prx.Method(Grid1.GetBinary().ToBinary<IBinaryObject>(obj));
- Assert.AreEqual(11, res.Deserialize<PortableObject>().Val);
+ Assert.AreEqual(11, res.Deserialize<BinarizableObject>().Val);
}
/// <summary>
@@ -484,7 +484,7 @@ namespace Apache.Ignite.Core.Tests.Services
[Test]
public void TestMarshalExceptionOnRead()
{
- var svc = new TestIgniteServicePortableErr();
+ var svc = new TestIgniteServiceBinarizableErr();
var ex = Assert.Throws<IgniteException>(() => Services.DeployMultiple(SvcName, svc, Grids.Length, 1));
Assert.AreEqual("Expected exception", ex.Message);
@@ -497,7 +497,7 @@ namespace Apache.Ignite.Core.Tests.Services
[Test]
public void TestMarshalExceptionOnWrite()
{
- var svc = new TestIgniteServicePortableErr {ThrowOnWrite = true};
+ var svc = new TestIgniteServiceBinarizableErr {ThrowOnWrite = true};
var ex = Assert.Throws<Exception>(() => Services.DeployMultiple(SvcName, svc, Grids.Length, 1));
Assert.AreEqual("Expected exception", ex.Message);
@@ -570,9 +570,9 @@ namespace Apache.Ignite.Core.Tests.Services
{
TypeConfigurations = new List<BinaryTypeConfiguration>
{
- new BinaryTypeConfiguration(typeof(TestIgniteServicePortable)),
- new BinaryTypeConfiguration(typeof(TestIgniteServicePortableErr)),
- new BinaryTypeConfiguration(typeof(PortableObject))
+ new BinaryTypeConfiguration(typeof(TestIgniteServiceBinarizable)),
+ new BinaryTypeConfiguration(typeof(TestIgniteServiceBinarizableErr)),
+ new BinaryTypeConfiguration(typeof(BinarizableObject))
}
}
};
@@ -734,11 +734,11 @@ namespace Apache.Ignite.Core.Tests.Services
if (context.AffinityKey != null && !(context.AffinityKey is int))
{
- var portableObject = context.AffinityKey as IBinaryObject;
+ var binaryObj = context.AffinityKey as IBinaryObject;
- var key = portableObject != null
- ? portableObject.Deserialize<PortableObject>()
- : (PortableObject) context.AffinityKey;
+ var key = binaryObj != null
+ ? binaryObj.Deserialize<BinarizableObject>()
+ : (BinarizableObject) context.AffinityKey;
Assert.AreEqual(AffKey, key.Val);
}
@@ -751,9 +751,9 @@ namespace Apache.Ignite.Core.Tests.Services
}
/// <summary>
- /// Test portable service.
+ /// Test binary service.
/// </summary>
- private class TestIgniteServicePortable : TestIgniteServiceSerializable, IBinarizable
+ private class TestIgniteServiceBinarizable : TestIgniteServiceSerializable, IBinarizable
{
/** <inheritdoc /> */
public void WriteBinary(IBinaryWriter writer)
@@ -769,9 +769,9 @@ namespace Apache.Ignite.Core.Tests.Services
}
/// <summary>
- /// Test portable service with exceptions in marshalling.
+ /// Test binary service with exceptions in marshalling.
/// </summary>
- private class TestIgniteServicePortableErr : TestIgniteServiceSerializable, IBinarizable
+ private class TestIgniteServiceBinarizableErr : TestIgniteServiceSerializable, IBinarizable
{
/** */
public bool ThrowOnWrite { get; set; }
@@ -813,9 +813,9 @@ namespace Apache.Ignite.Core.Tests.Services
}
/// <summary>
- /// Portable object.
+ /// Binary object.
/// </summary>
- private class PortableObject
+ private class BinarizableObject
{
public int Val { get; set; }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
index c75f003..a95ecd7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
@@ -38,16 +38,16 @@ namespace Apache.Ignite.Core.Tests
{
var testTypes = new[]
{
- typeof (TestGenericPortable<int>),
- typeof (TestGenericPortable<string>),
- typeof (TestGenericPortable<TestGenericPortable<int>>),
- typeof (TestGenericPortable<List<Tuple<int, string>>>),
- typeof (TestGenericPortable<List<TestGenericPortable<List<Tuple<int, string>>>>>),
- typeof (List<TestGenericPortable<List<TestGenericPortable<List<Tuple<int, string>>>>>>),
- typeof (TestGenericPortable<int, string>),
- typeof (TestGenericPortable<int, TestGenericPortable<string>>),
- typeof (TestGenericPortable<int, string, Type>),
- typeof (TestGenericPortable<int, string, TestGenericPortable<int, string, Type>>)
+ typeof (TestGenericBinarizable<int>),
+ typeof (TestGenericBinarizable<string>),
+ typeof (TestGenericBinarizable<TestGenericBinarizable<int>>),
+ typeof (TestGenericBinarizable<List<Tuple<int, string>>>),
+ typeof (TestGenericBinarizable<List<TestGenericBinarizable<List<Tuple<int, string>>>>>),
+ typeof (List<TestGenericBinarizable<List<TestGenericBinarizable<List<Tuple<int, string>>>>>>),
+ typeof (TestGenericBinarizable<int, string>),
+ typeof (TestGenericBinarizable<int, TestGenericBinarizable<string>>),
+ typeof (TestGenericBinarizable<int, string, Type>),
+ typeof (TestGenericBinarizable<int, string, TestGenericBinarizable<int, string, Type>>)
};
foreach (var type in testTypes)
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 12abefb..98ea106 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -604,7 +604,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
private void DataStreamerStreamReceiverInvoke(void* target, long rcvPtr, void* cache, long memPtr,
- byte keepPortable)
+ byte keepBinary)
{
SafeCall(() =>
{
@@ -612,14 +612,14 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
{
var reader = _ignite.Marshaller.StartUnmarshal(stream, BinaryMode.ForceBinary);
- var portableReceiver = reader.ReadObject<BinaryObject>();
+ var binaryReceiver = reader.ReadObject<BinaryObject>();
var receiver = _handleRegistry.Get<StreamReceiverHolder>(rcvPtr) ??
- portableReceiver.Deserialize<StreamReceiverHolder>();
+ binaryReceiver.Deserialize<StreamReceiverHolder>();
if (receiver != null)
receiver.Receive(_ignite, new UnmanagedNonReleaseableTarget(_ctx, cache), stream,
- keepPortable != 0);
+ keepBinary != 0);
}
});
}
@@ -893,12 +893,12 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
{
var reader = _ignite.Marshaller.StartUnmarshal(stream);
- bool srvKeepPortable = reader.ReadBoolean();
+ bool srvKeepBinary = reader.ReadBoolean();
var svc = reader.ReadObject<IService>();
ResourceProcessor.Inject(svc, _ignite);
- svc.Init(new ServiceContext(_ignite.Marshaller.StartUnmarshal(stream, srvKeepPortable)));
+ svc.Init(new ServiceContext(_ignite.Marshaller.StartUnmarshal(stream, srvKeepBinary)));
return _handleRegistry.Allocate(svc);
}
@@ -915,10 +915,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
{
var reader = _ignite.Marshaller.StartUnmarshal(stream);
- bool srvKeepPortable = reader.ReadBoolean();
+ bool srvKeepBinary = reader.ReadBoolean();
svc.Execute(new ServiceContext(
- _ignite.Marshaller.StartUnmarshal(stream, srvKeepPortable)));
+ _ignite.Marshaller.StartUnmarshal(stream, srvKeepBinary)));
}
});
}
@@ -935,9 +935,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
{
var reader = _ignite.Marshaller.StartUnmarshal(stream);
- bool srvKeepPortable = reader.ReadBoolean();
+ bool srvKeepBinary = reader.ReadBoolean();
- svc.Cancel(new ServiceContext(_ignite.Marshaller.StartUnmarshal(stream, srvKeepPortable)));
+ svc.Cancel(new ServiceContext(_ignite.Marshaller.StartUnmarshal(stream, srvKeepBinary)));
}
}
finally
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/examples/Config/example-cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache-query.xml b/modules/platforms/dotnet/examples/Config/example-cache-query.xml
index 7755645..a3b854b 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache-query.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache-query.xml
@@ -33,12 +33,12 @@
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration">
<property name="types">
<list>
- <value>Apache.Ignite.Examples.Dll.Portable.Account</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Address</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Employee</value>
- <value>Apache.Ignite.Examples.Dll.Portable.EmployeeKey</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Organization</value>
- <value>Apache.Ignite.Examples.Dll.Portable.OrganizationType</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Account</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Address</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Employee</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Organization</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.OrganizationType</value>
</list>
</property>
</bean>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/examples/Config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache.xml b/modules/platforms/dotnet/examples/Config/example-cache.xml
index d31938a..21a6a76 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache.xml
@@ -32,12 +32,12 @@
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration">
<property name="types">
<list>
- <value>Apache.Ignite.Examples.Dll.Portable.Account</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Address</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Employee</value>
- <value>Apache.Ignite.Examples.Dll.Portable.EmployeeKey</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Organization</value>
- <value>Apache.Ignite.Examples.Dll.Portable.OrganizationType</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Account</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Address</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Employee</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.Organization</value>
+ <value>Apache.Ignite.ExamplesDll.Binary.OrganizationType</value>
</list>
</property>
</bean>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 07c1847..d52ae4c 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -763,6 +763,7 @@
<exclude>**/*.fxcop</exclude>
<exclude>**/*.metaproj</exclude>
<exclude>**/*.metaproj.tmp</exclude>
+ <exclude>**/*.nunit</exclude>
<exclude>**/teamcity_boost.cpp</exclude>
<exclude>**/teamcity_messages.h</exclude>
<exclude>**/teamcity_messages.cpp</exclude>
[18/50] [abbrv] ignite git commit: IGNITE-1888 Start
org.apache.ignite.yardstick.IgniteNode with Spring Application context.
Posted by vo...@apache.org.
IGNITE-1888 Start org.apache.ignite.yardstick.IgniteNode with Spring Application context.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/92881e07
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/92881e07
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/92881e07
Branch: refs/heads/ignite-1816
Commit: 92881e07a561f25db5edd29ca5b9adc2c060d4b5
Parents: 6b158c9
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Nov 11 14:29:22 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Nov 11 14:29:22 2015 +0700
----------------------------------------------------------------------
.../org/apache/ignite/yardstick/IgniteNode.java | 23 ++++++++++++++------
1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/92881e07/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index ea3bd07..93c80d3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -22,6 +22,7 @@ import java.net.URL;
import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteSpring;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -30,9 +31,11 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.UrlResource;
import org.yardstickframework.BenchmarkConfiguration;
@@ -73,15 +76,20 @@ public class IgniteNode implements BenchmarkServer {
BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>");
- IgniteConfiguration c = loadConfiguration(args.configuration());
+ IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> tup = loadConfiguration(args.configuration());
+
+ IgniteConfiguration c = tup.get1();
assert c != null;
+ ApplicationContext appCtx = tup.get2();
+
+ assert appCtx != null;
+
for (CacheConfiguration cc : c.getCacheConfiguration()) {
// IgniteNode can not run in CLIENT_ONLY mode,
// except the case when it's used inside IgniteAbstractBenchmark.
- boolean cl = args.isClientOnly() && !args.isNearCache() && !clientMode ?
- false : args.isClientOnly();
+ boolean cl = args.isClientOnly() && (args.isNearCache() || clientMode);
if (cl)
c.setClientMode(true);
@@ -141,15 +149,16 @@ public class IgniteNode implements BenchmarkServer {
c.setCommunicationSpi(commSpi);
- ignite = Ignition.start(c);
+ ignite = IgniteSpring.start(c, appCtx);
}
/**
* @param springCfgPath Spring configuration file path.
- * @return Grid configuration.
+ * @return Tuple with grid configuration and Spring application context.
* @throws Exception If failed.
*/
- private static IgniteConfiguration loadConfiguration(String springCfgPath) throws Exception {
+ private static IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> loadConfiguration(String springCfgPath)
+ throws Exception {
URL url;
try {
@@ -191,7 +200,7 @@ public class IgniteNode implements BenchmarkServer {
if (cfgMap == null || cfgMap.isEmpty())
throw new Exception("Failed to find ignite configuration in: " + url);
- return cfgMap.values().iterator().next();
+ return new IgniteBiTuple<>(cfgMap.values().iterator().next(), springCtx);
}
/** {@inheritDoc} */
[50/50] [abbrv] ignite git commit: Merge branch 'ignite-1282' into
ignite-1816
Posted by vo...@apache.org.
Merge branch 'ignite-1282' into ignite-1816
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java
modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsAbstractSelfTest.java
modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a024304
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a024304
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a024304
Branch: refs/heads/ignite-1816
Commit: 6a02430402b7c04ba83b7c933905eaec1ef75ec7
Parents: ff38ae9 66c84ea
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Nov 18 10:58:31 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 18 10:58:31 2015 +0300
----------------------------------------------------------------------
.../rest/AbstractRestProcessorSelfTest.java | 5 +-
.../JettyRestProcessorAbstractSelfTest.java | 142 +-
.../java/org/apache/ignite/IgniteCache.java | 3 +-
.../org/apache/ignite/binary/BinaryObject.java | 9 -
.../eviction/random/RandomEvictionPolicy.java | 4 +
.../cache/store/CacheStoreSessionListener.java | 9 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 34 +-
.../jdbc/CacheJdbcStoreSessionListener.java | 8 +-
.../configuration/CacheConfiguration.java | 121 +-
.../configuration/ConnectorConfiguration.java | 61 +-
.../configuration/IgniteConfiguration.java | 32 +-
.../apache/ignite/internal/IgniteKernal.java | 21 +
.../org/apache/ignite/internal/IgnitionEx.java | 3 +
.../managers/communication/GridIoMessage.java | 4 +-
.../communication/GridIoMessageFactory.java | 10 +-
.../discovery/GridDiscoveryManager.java | 5 +-
.../internal/portable/BinaryObjectImpl.java | 7 -
.../portable/BinaryObjectOffheapImpl.java | 7 -
.../internal/portable/BinaryTypeImpl.java | 1 -
.../cache/CacheStoreBalancingWrapper.java | 5 +-
.../processors/cache/GridCacheAdapter.java | 22 +-
.../processors/cache/GridCacheContext.java | 29 +-
.../processors/cache/GridCacheEntryEx.java | 4 +-
.../processors/cache/GridCacheIoManager.java | 19 +-
.../processors/cache/GridCacheMapEntry.java | 91 +-
.../processors/cache/GridCacheMvccManager.java | 145 +-
.../GridCachePartitionExchangeManager.java | 184 +-
.../processors/cache/GridCachePreloader.java | 55 +-
.../cache/GridCachePreloaderAdapter.java | 40 +-
.../processors/cache/GridCacheProcessor.java | 59 +-
.../processors/cache/IgniteCacheProxy.java | 6 +
.../distributed/GridDistributedCacheEntry.java | 2 +-
.../distributed/GridDistributedTxMapping.java | 8 +-
.../GridDistributedTxRemoteAdapter.java | 5 +-
.../distributed/dht/GridDhtCacheEntry.java | 11 +-
.../distributed/dht/GridDhtLocalPartition.java | 63 +-
.../distributed/dht/GridDhtLockFuture.java | 7 +-
.../dht/GridDhtPartitionsReservation.java | 2 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 12 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 39 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 78 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 33 +-
.../dht/colocated/GridDhtColocatedCache.java | 7 +-
.../GridDhtPartitionDemandMessage.java | 14 +-
.../preloader/GridDhtPartitionDemandPool.java | 1192 ----------
.../dht/preloader/GridDhtPartitionDemander.java | 1408 ++++++++++++
.../dht/preloader/GridDhtPartitionSupplier.java | 1037 +++++++++
.../GridDhtPartitionSupplyMessageV2.java | 380 +++
.../preloader/GridDhtPartitionSupplyPool.java | 555 -----
.../GridDhtPartitionsExchangeFuture.java | 2 +
.../dht/preloader/GridDhtPreloader.java | 282 ++-
.../near/GridNearOptimisticTxPrepareFuture.java | 11 +-
.../near/GridNearTransactionalCache.java | 7 +-
.../near/GridNearTxFinishFuture.java | 157 +-
.../cache/distributed/near/GridNearTxLocal.java | 21 +-
.../CacheObjectBinaryProcessorImpl.java | 2 +-
.../cache/query/GridCacheQueryManager.java | 289 +--
.../cache/store/CacheOsStoreManager.java | 2 +-
.../store/GridCacheStoreManagerAdapter.java | 29 +-
.../cache/transactions/IgniteInternalTx.java | 3 +-
.../cache/transactions/IgniteTxAdapter.java | 251 +-
.../cache/transactions/IgniteTxHandler.java | 37 +-
.../transactions/IgniteTxLocalAdapter.java | 22 +-
.../cache/transactions/IgniteTxManager.java | 171 +-
.../datastructures/DataStructuresProcessor.java | 3 +
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../platform/PlatformContextImpl.java | 1 +
.../handlers/cache/GridCacheCommandHandler.java | 128 +-
.../handlers/query/QueryCommandHandler.java | 254 ++-
.../top/GridTopologyCommandHandler.java | 4 -
.../processors/task/GridTaskWorker.java | 4 +-
.../GridBoundedConcurrentLinkedHashMap.java | 7 +-
.../GridBoundedConcurrentLinkedHashSet.java | 7 +-
.../util/GridBoundedConcurrentOrderedMap.java | 39 +-
.../internal/util/GridConcurrentFactory.java | 11 +-
.../util/GridConcurrentLinkedHashSet.java | 9 +-
.../ignite/internal/util/IgniteUuidCache.java | 6 +-
.../util/future/GridCompoundFuture.java | 155 +-
.../ignite/internal/util/lang/GridTuple4.java | 2 +-
.../dotnet/PlatformDotNetConfiguration.java | 2 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 360 ++-
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 4 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 95 +-
.../messages/TcpDiscoveryAbstractMessage.java | 37 +
.../TcpDiscoveryStatusCheckMessage.java | 11 +
.../java/org/jsr166/ConcurrentHashMap8.java | 2 +-
.../java/org/jsr166/ConcurrentLinkedDeque8.java | 2 +-
.../org/jsr166/ConcurrentLinkedHashMap.java | 195 +-
.../resources/META-INF/classnames.properties | 196 +-
.../GridCacheAffinityBackupsSelfTest.java | 8 +
.../store/GridCacheBalancingStoreSelfTest.java | 220 +-
.../GridCacheLoadOnlyStoreAdapterSelfTest.java | 145 +-
.../portable/TestCachingMetadataHandler.java | 45 +
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
.../GridCacheMissingCommitVersionSelfTest.java | 40 +-
.../processors/cache/GridCacheTestEntryEx.java | 3 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 2 +-
...CacheAtomicReferenceApiSelfAbstractTest.java | 30 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 21 +-
...gniteCachePutRetryTransactionalSelfTest.java | 10 +
...achePartitionedMultiNodeFullApiSelfTest.java | 2 +-
.../GridCacheRebalancingAsyncSelfTest.java | 68 +
.../GridCacheRebalancingSyncSelfTest.java | 506 ++++
...eRebalancingUnmarshallingFailedSelfTest.java | 147 ++
.../GridCacheReplicatedPreloadSelfTest.java | 22 +-
.../GridCachePortableStoreAbstractSelfTest.java | 2 +-
.../continuous/GridEventConsumeSelfTest.java | 2 +-
...dBoundedConcurrentLinkedHashMapSelfTest.java | 2 +-
.../GridConcurrentLinkedHashMapSelfTest.java | 62 +-
.../platform/PlatformComputeBinarizable.java | 42 +
.../PlatformComputeBinarizableArgTask.java | 119 +
.../platform/PlatformComputeEchoTask.java | 12 +-
.../PlatformComputeJavaBinarizable.java | 39 +
.../platform/PlatformComputeJavaPortable.java | 39 -
.../platform/PlatformComputePortable.java | 42 -
.../PlatformComputePortableArgTask.java | 119 -
.../tcp/TcpDiscoveryMultiThreadedTest.java | 158 +-
.../discovery/tcp/TcpDiscoveryRestartTest.java | 10 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 476 +++-
.../spi/discovery/tcp/TestTcpDiscoverySpi.java | 46 +
.../TcpDiscoveryMulticastIpFinderSelfTest.java | 28 +-
.../testframework/junits/GridAbstractTest.java | 32 +-
.../junits/common/GridCommonAbstractTest.java | 25 +-
.../testsuites/IgniteCacheTestSuite3.java | 4 +
...rrentLinkedHashMapMultiThreadedSelfTest.java | 104 +-
.../tcp/GridOrderedMessageCancelSelfTest.java | 18 +-
.../Apache.Ignite.Benchmarks.csproj | 4 +-
.../Apache.Ignite.Benchmarks/BenchmarkRunner.cs | 4 +-
.../Binary/BinarizableReadBenchmark.cs | 125 +
.../Binary/BinarizableWriteBenchmark.cs | 135 ++
.../Interop/PlatformBenchmarkBase.cs | 8 +-
.../Portable/PortableReadBenchmark.cs | 126 -
.../Portable/PortableWriteBenchmark.cs | 135 --
.../Apache.Ignite.Core.Tests.csproj | 27 +-
.../Apache.Ignite.Core.Tests.nunit | 7 +
.../Binary/BinaryBuilderSelfTest.cs | 1721 ++++++++++++++
.../Binary/BinarySelfTest.cs | 2157 ++++++++++++++++++
.../Binary/BinaryStructureTest.cs | 250 ++
.../BinaryConfigurationTest.cs | 173 ++
.../Cache/CacheAbstractTest.cs | 94 +-
.../Cache/CacheAffinityTest.cs | 4 +-
.../Cache/CacheDynamicStartTest.cs | 6 +-
.../Cache/Query/CacheQueriesTest.cs | 95 +-
.../Continuous/ContinuousQueryAbstractTest.cs | 287 ++-
.../ContinuousQueryNoBackupAbstractTest.cs | 4 +-
.../Cache/Store/CacheStoreTest.cs | 101 +-
.../Compute/AbstractTaskTest.cs | 8 +-
.../Compute/BinarizableClosureTaskTest.cs | 185 ++
.../Compute/BinarizableTaskTest.cs | 269 +++
.../Compute/ComputeApiTest.cs | 84 +-
.../Compute/FailoverTaskSelfTest.cs | 18 +-
.../Forked/ForkedBinarizableClosureTaskTest.cs | 30 +
.../Forked/ForkedPortableClosureTaskTest.cs | 30 -
.../Compute/Forked/ForkedResourceTaskTest.cs | 3 -
.../Forked/ForkedSerializableClosureTaskTest.cs | 3 -
.../Compute/PortableClosureTaskTest.cs | 217 --
.../Compute/PortableTaskTest.cs | 269 ---
.../Compute/TaskAdapterTest.cs | 14 +-
.../Compute/TaskResultTest.cs | 46 +-
.../Config/Compute/compute-grid1.xml | 6 +-
.../Config/Compute/compute-standalone.xml | 14 +-
.../Apache.Ignite.Core.Tests/Config/binary.xml | 56 +
.../Config/cache-binarizables.xml | 78 +
.../Config/cache-portables.xml | 78 -
.../Config/cache-query-continuous.xml | 8 +-
.../Config/marshaller-explicit.xml | 47 +
.../Config/marshaller-portable.xml | 43 -
.../native-client-test-cache-parallel-store.xml | 2 +-
.../Config/native-client-test-cache-store.xml | 6 +-
.../Config/native-client-test-cache.xml | 51 -
.../Config/portable.xml | 56 -
.../Dataload/DataStreamerTest.cs | 42 +-
.../Apache.Ignite.Core.Tests/EventsTest.cs | 16 +-
.../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 28 +-
.../Apache.Ignite.Core.Tests/FutureTest.cs | 10 +-
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 10 +-
.../Portable/PortableApiSelfTest.cs | 1777 ---------------
.../Portable/PortableSelfTest.cs | 2157 ------------------
.../Portable/PortableStructureTest.cs | 250 --
.../PortableConfigurationTest.cs | 173 --
.../Query/BinarizablePerson.cs | 69 +
.../Query/ImplicitBinarizablePerson.cs | 46 +
.../Query/ImplicitPortablePerson.cs | 46 -
.../Query/NoDefBinarizablePerson.cs | 35 +
.../Query/NoDefPortablePerson.cs | 35 -
.../Query/PortablePerson.cs | 69 -
.../Services/ServiceProxyTest.cs | 130 +-
.../Services/ServicesTest.cs | 88 +-
.../TypeResolverTest.cs | 20 +-
.../Cache/Event/ICacheEntryEvent.cs | 7 +-
.../Apache.Ignite.Core/Cache/Query/ScanQuery.cs | 15 +-
.../Impl/Binary/BinaryReader.cs | 43 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 13 +-
.../Impl/Cache/Event/CacheEntryCreateEvent.cs | 6 +
.../Impl/Cache/Event/CacheEntryRemoveEvent.cs | 6 +
.../Impl/Cache/Event/CacheEntryUpdateEvent.cs | 6 +
.../Query/Continuous/ContinuousQueryUtils.cs | 37 +-
.../Impl/Compute/ComputeImpl.cs | 12 +-
.../Impl/Compute/ComputeTaskHolder.cs | 79 +-
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 20 +-
.../examples/Config/example-cache-query.xml | 12 +-
.../dotnet/examples/Config/example-cache.xml | 12 +-
modules/rest-http/pom.xml | 11 +
.../visor/commands/open/VisorOpenCommand.scala | 14 +-
.../scala/org/apache/ignite/visor/visor.scala | 3 +-
modules/yardstick/README.txt | 16 +-
.../config/benchmark-multicast.properties | 9 +-
.../yardstick/config/benchmark-store.properties | 86 +-
.../yardstick/config/ignite-store-config.xml | 31 +-
.../yardstick/IgniteBenchmarkArguments.java | 2 +-
.../ignite/yardstick/IgniteBenchmarkUtils.java | 75 +
.../org/apache/ignite/yardstick/IgniteNode.java | 23 +-
.../IgniteAccountSerializableTxBenchmark.java | 11 +-
.../cache/IgniteAccountTxBenchmark.java | 11 +-
.../cache/IgniteGetAllPutAllTxBenchmark.java | 73 +
.../cache/IgnitePutGetTxBenchmark.java | 41 +-
.../yardstick/cache/IgnitePutTxBenchmark.java | 10 +
.../cache/IgnitePutTxPrimaryOnlyBenchmark.java | 65 +
.../IgnitePutTxSkipLocalBackupBenchmark.java | 65 +
.../cache/WaitMapExchangeFinishCallable.java | 95 +
...IgniteTransactionalWriteInvokeBenchmark.java | 41 +-
.../IgniteTransactionalWriteReadBenchmark.java | 41 +-
modules/zookeeper/pom.xml | 2 +-
parent/pom.xml | 1 +
226 files changed, 14554 insertions(+), 10001 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
index 2630a40,40b6252..60c135d
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@@ -67,11 -66,6 +67,10 @@@ public class BinaryTypeImpl implements
return meta.affinityKeyFieldName();
}
+ /** {@inheritDoc} */
+ public PortableContext context() {
+ return ctx;
+ }
-
/**
* @return Metadata.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 93e9a8a,05d3515..a5c3ad2
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@@ -33,8 -33,8 +33,9 @@@ import org.apache.ignite.events.JobEven
import org.apache.ignite.events.SwapSpaceEvent;
import org.apache.ignite.events.TaskEvent;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.portable.BinaryTypeImpl;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.BinaryMetadata;
++import org.apache.ignite.internal.portable.BinaryMetaDataImpl;
import org.apache.ignite.internal.portable.BinaryRawReaderEx;
import org.apache.ignite.internal.portable.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index 6cb87ad,e373b89..9755033
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@@ -67,10 -67,9 +67,10 @@@
</bean>
</property>
- <!-- Portable marshaller configuration -->
+ <!-- Binary marshaller configuration -->
<property name="marshaller">
<bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
+ <property name="compactFooter" value="false" />
<property name="typeConfigurations">
<list>
<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a024304/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
[13/50] [abbrv] ignite git commit: Warning is writeThrough==false &&
writeBehind==true
Posted by vo...@apache.org.
Warning is writeThrough==false && writeBehind==true
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/50ede23a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/50ede23a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/50ede23a
Branch: refs/heads/ignite-1816
Commit: 50ede23a1079271cd21c338968bf936623416a16
Parents: 3de9d47
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 10 16:44:27 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 10 16:44:27 2015 -0800
----------------------------------------------------------------------
.../store/GridCacheStoreManagerAdapter.java | 26 ++++++++++++++------
1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/50ede23a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index 174e1ce..dd54da5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -188,12 +188,24 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
CacheConfiguration cfg = cctx.config();
- if (cfgStore != null && !cfg.isWriteThrough() && !cfg.isReadThrough()) {
- U.quietAndWarn(log,
- "Persistence store is configured, but both read-through and write-through are disabled. This " +
- "configuration makes sense if the store implements loadCache method only. If this is the " +
- "case, ignore this warning. Otherwise, fix the configuration for cache: " + cfg.getName(),
- "Persistence store is configured, but both read-through and write-through are disabled.");
+ if (cfgStore != null) {
+ if (!cfg.isWriteThrough() && !cfg.isReadThrough()) {
+ U.quietAndWarn(log,
+ "Persistence store is configured, but both read-through and write-through are disabled. This " +
+ "configuration makes sense if the store implements loadCache method only. If this is the " +
+ "case, ignore this warning. Otherwise, fix the configuration for the cache: " + cfg.getName(),
+ "Persistence store is configured, but both read-through and write-through are disabled " +
+ "for cache: " + cfg.getName());
+ }
+
+ if (!cfg.isWriteThrough() && cfg.isWriteBehindEnabled()) {
+ U.quietAndWarn(log,
+ "To enable write-behind mode for the cache store it's also required to set " +
+ "CacheConfiguration.setWriteThrough(true) property, otherwise the persistence " +
+ "store will be never updated. Consider fixing configuration for the cache: " + cfg.getName(),
+ "Write-behind mode for the cache store also requires CacheConfiguration.setWriteThrough(true) " +
+ "property. Fix configuration for the cache: " + cfg.getName());
+ }
}
sesLsnrs = CU.startStoreSessionListeners(cctx.kernalContext(), cfg.getCacheStoreSessionListenerFactories());
@@ -1256,4 +1268,4 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
}
}
}
-}
\ No newline at end of file
+}
[02/50] [abbrv] ignite git commit: Ignite-1093 Backward compatibility
fix.
Posted by vo...@apache.org.
Ignite-1093 Backward compatibility fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5e36b267
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5e36b267
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5e36b267
Branch: refs/heads/ignite-1816
Commit: 5e36b267ef65b5ee804d78d73f874c685692e3d9
Parents: 6ea3b5c
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 9 18:11:43 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 9 19:05:06 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/preloader/GridDhtPreloader.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5e36b267/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index c634ff5..8e56c2d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -207,7 +207,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
});
supplier = new GridDhtPartitionSupplier(cctx);
- demander = new GridDhtPartitionDemander(cctx, busyLock);
+ demander = new GridDhtPartitionDemander(cctx, demandLock);
supplier.start();
demander.start();
[35/50] [abbrv] ignite git commit: IGNITE-1912: Fixed a bug
preventing continuous query from correct work with value types.
Posted by vo...@apache.org.
IGNITE-1912: Fixed a bug preventing continuous query from correct work with value types.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b96886dd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b96886dd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b96886dd
Branch: refs/heads/ignite-1816
Commit: b96886ddb9fae2d77b07acd7303ec6548a65ed63
Parents: 1de6539
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Tue Nov 17 16:43:14 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 17 16:43:14 2015 +0300
----------------------------------------------------------------------
.../Continuous/ContinuousQueryAbstractTest.cs | 77 +++++++++++++++++---
.../Cache/Event/ICacheEntryEvent.cs | 7 +-
.../Impl/Binary/BinaryReader.cs | 43 ++++++++---
.../Impl/Cache/Event/CacheEntryCreateEvent.cs | 6 ++
.../Impl/Cache/Event/CacheEntryRemoveEvent.cs | 6 ++
.../Impl/Cache/Event/CacheEntryUpdateEvent.cs | 6 ++
.../Query/Continuous/ContinuousQueryUtils.cs | 37 +++-------
7 files changed, 134 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index 8005e83..b81405b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -32,9 +32,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Cache.Event;
using Apache.Ignite.Core.Resource;
using NUnit.Framework;
- using CQU = Apache.Ignite.Core.Impl.Cache.Query.Continuous.ContinuousQueryUtils;
/// <summary>
/// Tests for continuous query.
@@ -637,6 +637,56 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
(cbEvt.entries.First().Value as IBinaryObject).Deserialize<PortableEntry>());
}
}
+ /// <summary>
+ /// Test value types (special handling is required for nulls).
+ /// </summary>
+ [Test]
+ public void TestValueTypes()
+ {
+ var cache = grid1.GetCache<int, int>(cacheName);
+
+ var qry = new ContinuousQuery<int, int>(new Listener<int>());
+
+ var key = PrimaryKey(cache);
+
+ using (cache.QueryContinuous(qry))
+ {
+ // First update
+ cache.Put(key, 1);
+
+ CallbackEvent cbEvt;
+
+ Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
+ var cbEntry = cbEvt.entries.Single();
+ Assert.IsFalse(cbEntry.HasOldValue);
+ Assert.IsTrue(cbEntry.HasValue);
+ Assert.AreEqual(key, cbEntry.Key);
+ Assert.AreEqual(null, cbEntry.OldValue);
+ Assert.AreEqual(1, cbEntry.Value);
+
+ // Second update
+ cache.Put(key, 2);
+
+ Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
+ cbEntry = cbEvt.entries.Single();
+ Assert.IsTrue(cbEntry.HasOldValue);
+ Assert.IsTrue(cbEntry.HasValue);
+ Assert.AreEqual(key, cbEntry.Key);
+ Assert.AreEqual(1, cbEntry.OldValue);
+ Assert.AreEqual(2, cbEntry.Value);
+
+ // Remove
+ cache.Remove(key);
+
+ Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
+ cbEntry = cbEvt.entries.Single();
+ Assert.IsTrue(cbEntry.HasOldValue);
+ Assert.IsFalse(cbEntry.HasValue);
+ Assert.AreEqual(key, cbEntry.Key);
+ Assert.AreEqual(2, cbEntry.OldValue);
+ Assert.AreEqual(null, cbEntry.Value);
+ }
+ }
/// <summary>
/// Test whether buffer size works fine.
@@ -946,6 +996,20 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
+ /// Creates object-typed event.
+ /// </summary>
+ private static ICacheEntryEvent<object, object> CreateEvent<T, V>(ICacheEntryEvent<T,V> e)
+ {
+ if (!e.HasOldValue)
+ return new CacheEntryCreateEvent<object, object>(e.Key, e.Value);
+
+ if (!e.HasValue)
+ return new CacheEntryRemoveEvent<object, object>(e.Key, e.OldValue);
+
+ return new CacheEntryUpdateEvent<object, object>(e.Key, e.OldValue, e.Value);
+ }
+
+ /// <summary>
/// Portable entry.
/// </summary>
public class PortableEntry
@@ -1003,8 +1067,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
if (err)
throw new Exception("Filter error.");
- FILTER_EVTS.Add(new FilterEvent(ignite,
- CQU.CreateEvent<object, object>(evt.Key, evt.OldValue, evt.Value)));
+ FILTER_EVTS.Add(new FilterEvent(ignite, CreateEvent(evt)));
return res;
}
@@ -1090,13 +1153,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/** <inheritDoc /> */
public void OnEvent(IEnumerable<ICacheEntryEvent<int, V>> evts)
{
- ICollection<ICacheEntryEvent<object, object>> entries0 =
- new List<ICacheEntryEvent<object, object>>();
-
- foreach (ICacheEntryEvent<int, V> evt in evts)
- entries0.Add(CQU.CreateEvent<object, object>(evt.Key, evt.OldValue, evt.Value));
-
- CB_EVTS.Add(new CallbackEvent(entries0));
+ CB_EVTS.Add(new CallbackEvent(evts.Select(CreateEvent).ToList()));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
index 9c2665e..9ecaee0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Core.Cache.Event
/// <summary>
/// Cache entry event.
/// </summary>
- public interface ICacheEntryEvent<TK, TV> : ICacheEntry<TK, TV>
+ public interface ICacheEntryEvent<out TK, out TV> : ICacheEntry<TK, TV>
{
/// <summary>
/// Event type.
@@ -33,6 +33,11 @@ namespace Apache.Ignite.Core.Cache.Event
TV OldValue { get; }
/// <summary>
+ /// Whether value exists.
+ /// </summary>
+ bool HasValue { get; }
+
+ /// <summary>
/// Whether old value exists.
/// </summary>
bool HasOldValue { get; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 1dec7ba..53f6f4a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -503,9 +503,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Enable detach mode for the next object read.
/// </summary>
- public void DetachNext()
+ public BinaryReader DetachNext()
{
_detach = true;
+
+ return this;
}
/// <summary>
@@ -514,6 +516,21 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <returns>Deserialized object.</returns>
public T Deserialize<T>()
{
+ T res;
+
+ if (!TryDeserialize(out res) && default(T) != null)
+ throw new BinaryObjectException(string.Format("Invalid data on deserialization. " +
+ "Expected: '{0}' But was: null", typeof (T)));
+
+ return res;
+ }
+
+ /// <summary>
+ /// Deserialize object.
+ /// </summary>
+ /// <returns>Deserialized object.</returns>
+ public bool TryDeserialize<T>(out T res)
+ {
int pos = Stream.Position;
byte hdr = Stream.ReadByte();
@@ -525,24 +542,32 @@ namespace Apache.Ignite.Core.Impl.Binary
switch (hdr)
{
case BinaryUtils.HdrNull:
- if (default(T) != null)
- throw new BinaryObjectException(string.Format("Invalid data on deserialization. " +
- "Expected: '{0}' But was: null", typeof (T)));
+ res = default(T);
- return default(T);
+ return false;
case BinaryUtils.HdrHnd:
- return ReadHandleObject<T>(pos);
+ res = ReadHandleObject<T>(pos);
+
+ return true;
case BinaryUtils.HdrFull:
- return ReadFullObject<T>(pos);
+ res = ReadFullObject<T>(pos);
+
+ return true;
case BinaryUtils.TypeBinary:
- return ReadBinaryObject<T>(doDetach);
+ res = ReadBinaryObject<T>(doDetach);
+
+ return true;
}
if (BinaryUtils.IsPredefinedType(hdr))
- return BinarySystemHandlers.ReadSystemType<T>(hdr, this);
+ {
+ res = BinarySystemHandlers.ReadSystemType<T>(hdr, this);
+
+ return true;
+ }
throw new BinaryObjectException("Invalid header on deserialization [pos=" + pos + ", hdr=" + hdr + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
index 8d9dfef..fc49903 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
@@ -60,6 +60,12 @@ namespace Apache.Ignite.Core.Impl.Cache.Event
}
/** <inheritdoc /> */
+ public bool HasValue
+ {
+ get { return true; }
+ }
+
+ /** <inheritdoc /> */
public bool HasOldValue
{
get { return false; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
index a44a800..cce3d65 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
@@ -60,6 +60,12 @@ namespace Apache.Ignite.Core.Impl.Cache.Event
}
/** <inheritdoc /> */
+ public bool HasValue
+ {
+ get { return false; }
+ }
+
+ /** <inheritdoc /> */
public bool HasOldValue
{
get { return true; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
index e6fb927..6d954e5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
@@ -65,6 +65,12 @@ namespace Apache.Ignite.Core.Impl.Cache.Event
}
/** <inheritdoc /> */
+ public bool HasValue
+ {
+ get { return true; }
+ }
+
+ /** <inheritdoc /> */
public bool HasOldValue
{
get { return true; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/b96886dd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
index 96fd621..729b251 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
@@ -74,41 +74,22 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
/// <returns>Event.</returns>
private static ICacheEntryEvent<TK, TV> ReadEvent0<TK, TV>(BinaryReader reader)
{
- reader.DetachNext();
- TK key = reader.ReadObject<TK>();
+ var key = reader.DetachNext().ReadObject<TK>();
- reader.DetachNext();
- TV oldVal = reader.ReadObject<TV>();
+ // Read as objects: TV may be value type
+ TV oldVal, val;
- reader.DetachNext();
- TV val = reader.ReadObject<TV>();
+ var hasOldVal = reader.DetachNext().TryDeserialize(out oldVal);
+ var hasVal = reader.DetachNext().TryDeserialize(out val);
- return CreateEvent(key, oldVal, val);
- }
-
- /// <summary>
- /// Create event.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="oldVal">Old value.</param>
- /// <param name="val">Value.</param>
- /// <returns>Event.</returns>
- public static ICacheEntryEvent<TK, TV> CreateEvent<TK, TV>(TK key, TV oldVal, TV val)
- {
- if (oldVal == null)
- {
- Debug.Assert(val != null);
+ Debug.Assert(hasVal || hasOldVal);
+ if (!hasOldVal)
return new CacheEntryCreateEvent<TK, TV>(key, val);
- }
-
- if (val == null)
- {
- Debug.Assert(oldVal != null);
+ if (!hasVal)
return new CacheEntryRemoveEvent<TK, TV>(key, oldVal);
- }
-
+
return new CacheEntryUpdateEvent<TK, TV>(key, oldVal, val);
}
}
[28/50] [abbrv] ignite git commit: ignite-1758 Discovery fixes
Posted by vo...@apache.org.
ignite-1758 Discovery fixes
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/80147128
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/80147128
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/80147128
Branch: refs/heads/ignite-1816
Commit: 80147128a3b07f927dec65f0a6934f6782efab5c
Parents: 5a116cb
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 17 09:48:58 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 17 09:48:58 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 360 +++++++++++----
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 4 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 95 ++--
.../messages/TcpDiscoveryAbstractMessage.java | 37 ++
.../TcpDiscoveryStatusCheckMessage.java | 11 +
.../tcp/TcpDiscoveryMultiThreadedTest.java | 158 ++++---
.../discovery/tcp/TcpDiscoveryRestartTest.java | 10 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 459 ++++++++++++++++++-
.../TcpDiscoveryMulticastIpFinderSelfTest.java | 28 +-
.../testframework/junits/GridAbstractTest.java | 29 +-
10 files changed, 942 insertions(+), 249 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 0fe2881..ae23d0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -159,6 +159,10 @@ class ServerImpl extends TcpDiscoveryImpl {
private static final int ENSURED_MSG_HIST_SIZE = getInteger(IGNITE_DISCOVERY_HISTORY_SIZE, 1024 * 10);
/** */
+ private static final IgniteProductVersion CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE =
+ IgniteProductVersion.fromString("1.5.0");
+
+ /** */
private final ThreadPoolExecutor utilityPool = new ThreadPoolExecutor(0, 1, 2000, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
@@ -191,10 +195,10 @@ class ServerImpl extends TcpDiscoveryImpl {
private StatisticsPrinter statsPrinter;
/** Failed nodes (but still in topology). */
- private Collection<TcpDiscoveryNode> failedNodes = new HashSet<>();
+ private final Collection<TcpDiscoveryNode> failedNodes = new HashSet<>();
/** Leaving nodes (but still in topology). */
- private Collection<TcpDiscoveryNode> leavingNodes = new HashSet<>();
+ private final Collection<TcpDiscoveryNode> leavingNodes = new HashSet<>();
/** If non-shared IP finder is used this flag shows whether IP finder contains local address. */
private boolean ipFinderHasLocAddr;
@@ -1080,13 +1084,34 @@ class ServerImpl extends TcpDiscoveryImpl {
openSock = true;
+ TcpDiscoveryHandshakeRequest req = new TcpDiscoveryHandshakeRequest(locNodeId);
+
// Handshake.
- spi.writeToSocket(sock, new TcpDiscoveryHandshakeRequest(locNodeId), timeoutHelper.nextTimeoutChunk(
- spi.getSocketTimeout()));
+ spi.writeToSocket(sock, req, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
TcpDiscoveryHandshakeResponse res = spi.readMessage(sock, null, timeoutHelper.nextTimeoutChunk(
ackTimeout0));
+ if (msg instanceof TcpDiscoveryJoinRequestMessage) {
+ boolean ignore = false;
+
+ synchronized (failedNodes) {
+ for (TcpDiscoveryNode failedNode : failedNodes) {
+ if (failedNode.id().equals(res.creatorNodeId())) {
+ if (log.isDebugEnabled())
+ log.debug("Ignore response from node from failed list: " + res);
+
+ ignore = true;
+
+ break;
+ }
+ }
+ }
+
+ if (ignore)
+ break;
+ }
+
if (locNodeId.equals(res.creatorNodeId())) {
if (log.isDebugEnabled())
log.debug("Handshake response from local node: " + res);
@@ -1104,7 +1129,7 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
if (debugMode)
- debugLog("Message has been sent directly to address [msg=" + msg + ", addr=" + addr +
+ debugLog(msg, "Message has been sent directly to address [msg=" + msg + ", addr=" + addr +
", rmtNodeId=" + res.creatorNodeId() + ']');
if (log.isDebugEnabled())
@@ -1754,6 +1779,32 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * Adds failed nodes specified in the received message to the local failed nodes list.
+ *
+ * @param msg Message.
+ */
+ private void processMessageFailedNodes(TcpDiscoveryAbstractMessage msg) {
+ if (msg.failedNodes() != null) {
+ for (UUID nodeId : msg.failedNodes()) {
+ TcpDiscoveryNode failedNode = ring.node(nodeId);
+
+ if (failedNode != null) {
+ if (!failedNode.isLocal()) {
+ boolean added;
+
+ synchronized (mux) {
+ added = failedNodes.add(failedNode);
+ }
+
+ if (added && log.isDebugEnabled())
+ log.debug("Added node to failed nodes list [node=" + failedNode + ", msg=" + msg + ']');
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Discovery messages history used for client reconnect.
*/
private class EnsuredMessageHistory {
@@ -2131,10 +2182,28 @@ class ServerImpl extends TcpDiscoveryImpl {
log.debug("Processing message [cls=" + msg.getClass().getSimpleName() + ", id=" + msg.id() + ']');
if (debugMode)
- debugLog("Processing message [cls=" + msg.getClass().getSimpleName() + ", id=" + msg.id() + ']');
+ debugLog(msg, "Processing message [cls=" + msg.getClass().getSimpleName() + ", id=" + msg.id() + ']');
+
+ if (locNode.internalOrder() == 0) {
+ boolean process = false;
+
+ if (msg instanceof TcpDiscoveryNodeAddedMessage)
+ process = ((TcpDiscoveryNodeAddedMessage)msg).node().equals(locNode);
+
+ if (!process) {
+ if (log.isDebugEnabled()) {
+ log.debug("Ignore message, local node order is not initialized [msg=" + msg +
+ ", locNode=" + locNode + ']');
+ }
+
+ return;
+ }
+ }
spi.stats.onMessageProcessingStarted(msg);
+ processMessageFailedNodes(msg);
+
if (msg instanceof TcpDiscoveryJoinRequestMessage)
processJoinRequestMessage((TcpDiscoveryJoinRequestMessage)msg);
@@ -2200,6 +2269,8 @@ class ServerImpl extends TcpDiscoveryImpl {
checkHeartbeatsReceiving();
checkPendingCustomMessages();
+
+ checkFailedNodesList();
}
/**
@@ -2262,50 +2333,50 @@ class ServerImpl extends TcpDiscoveryImpl {
boolean sent = false;
- boolean searchNext = true;
+ boolean newNextNode = false;
UUID locNodeId = getLocalNodeId();
while (true) {
- if (searchNext) {
- TcpDiscoveryNode newNext = ring.nextNode(failedNodes);
-
- if (newNext == null) {
- if (log.isDebugEnabled())
- log.debug("No next node in topology.");
+ TcpDiscoveryNode newNext = ring.nextNode(failedNodes);
- if (debugMode)
- debugLog("No next node in topology.");
+ if (newNext == null) {
+ if (log.isDebugEnabled())
+ log.debug("No next node in topology.");
- if (ring.hasRemoteNodes() && !(msg instanceof TcpDiscoveryConnectionCheckMessage) &&
- !(msg instanceof TcpDiscoveryStatusCheckMessage && msg.creatorNodeId().equals(locNodeId))) {
- msg.senderNodeId(locNodeId);
+ if (debugMode)
+ debugLog(msg, "No next node in topology.");
- addMessage(msg);
- }
+ if (ring.hasRemoteNodes() && !(msg instanceof TcpDiscoveryConnectionCheckMessage) &&
+ !(msg instanceof TcpDiscoveryStatusCheckMessage && msg.creatorNodeId().equals(locNodeId))) {
+ msg.senderNodeId(locNodeId);
- break;
+ addMessage(msg);
}
- if (!newNext.equals(next)) {
- if (log.isDebugEnabled())
- log.debug("New next node [newNext=" + newNext + ", formerNext=" + next +
- ", ring=" + ring + ", failedNodes=" + failedNodes + ']');
+ break;
+ }
- if (debugMode)
- debugLog("New next node [newNext=" + newNext + ", formerNext=" + next +
- ", ring=" + ring + ", failedNodes=" + failedNodes + ']');
+ if (!newNext.equals(next)) {
+ if (log.isDebugEnabled())
+ log.debug("New next node [newNext=" + newNext + ", formerNext=" + next +
+ ", ring=" + ring + ", failedNodes=" + failedNodes + ']');
- U.closeQuiet(sock);
+ if (debugMode)
+ debugLog(msg, "New next node [newNext=" + newNext + ", formerNext=" + next +
+ ", ring=" + ring + ", failedNodes=" + failedNodes + ']');
- sock = null;
+ U.closeQuiet(sock);
- next = newNext;
- }
- else if (log.isDebugEnabled())
- log.debug("Next node remains the same [nextId=" + next.id() +
- ", nextOrder=" + next.internalOrder() + ']');
+ sock = null;
+
+ next = newNext;
+
+ newNextNode = true;
}
+ else if (log.isDebugEnabled())
+ log.debug("Next node remains the same [nextId=" + next.id() +
+ ", nextOrder=" + next.internalOrder() + ']');
// Flag that shows whether next node exists and accepts incoming connections.
boolean nextNodeExists = sock != null;
@@ -2379,8 +2450,8 @@ class ServerImpl extends TcpDiscoveryImpl {
"expected [expectedId=" + next.id() + ", rcvdId=" + nextId + ']');
if (debugMode)
- debugLog("Failed to restore ring because next node ID received is not as " +
- "expected [expectedId=" + next.id() + ", rcvdId=" + nextId + ']');
+ debugLog(msg, "Failed to restore ring because next node ID received is not " +
+ "as expected [expectedId=" + next.id() + ", rcvdId=" + nextId + ']');
break;
}
@@ -2401,8 +2472,8 @@ class ServerImpl extends TcpDiscoveryImpl {
", rcvd=" + nextOrder + ", id=" + next.id() + ']');
if (debugMode)
- debugLog("Failed to restore ring because next node order received " +
- "is not as expected [expected=" + next.internalOrder() +
+ debugLog(msg, "Failed to restore ring because next node order " +
+ "received is not as expected [expected=" + next.internalOrder() +
", rcvd=" + nextOrder + ", id=" + next.id() + ']');
break;
@@ -2413,7 +2484,7 @@ class ServerImpl extends TcpDiscoveryImpl {
log.debug("Initialized connection with next node: " + next.id());
if (debugMode)
- debugLog("Initialized connection with next node: " + next.id());
+ debugLog(msg, "Initialized connection with next node: " + next.id());
errs = null;
@@ -2477,13 +2548,20 @@ class ServerImpl extends TcpDiscoveryImpl {
assert !forceSndPending || msg instanceof TcpDiscoveryNodeLeftMessage;
- if (failure || forceSndPending) {
+ boolean sndPending=
+ (newNextNode && ring.minimumNodeVersion().compareTo(CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE) >= 0) ||
+ failure ||
+ forceSndPending;
+
+ if (sndPending) {
if (log.isDebugEnabled())
log.debug("Pending messages will be sent [failure=" + failure +
+ ", newNextNode=" + newNextNode +
", forceSndPending=" + forceSndPending + ']');
if (debugMode)
- debugLog("Pending messages will be sent [failure=" + failure +
+ debugLog(msg, "Pending messages will be sent [failure=" + failure +
+ ", newNextNode=" + newNextNode +
", forceSndPending=" + forceSndPending + ']');
for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs) {
@@ -2513,7 +2591,7 @@ class ServerImpl extends TcpDiscoveryImpl {
", res=" + res + ']');
if (debugMode)
- debugLog("Pending message has been sent to next node [msgId=" + msg.id() +
+ debugLog(msg, "Pending message has been sent to next node [msgId=" + msg.id() +
", pendingMsgId=" + pendingMsg.id() + ", next=" + next.id() +
", res=" + res + ']');
@@ -2540,6 +2618,14 @@ class ServerImpl extends TcpDiscoveryImpl {
if (timeoutHelper == null)
timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+ if (!failedNodes.isEmpty()) {
+ for (TcpDiscoveryNode failedNode : failedNodes) {
+ assert !failedNode.equals(next) : failedNode;
+
+ msg.addFailedNode(failedNode.id());
+ }
+ }
+
writeToSocket(sock, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
@@ -2548,15 +2634,17 @@ class ServerImpl extends TcpDiscoveryImpl {
onMessageExchanged();
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug("Message has been sent to next node [msg=" + msg +
", next=" + next.id() +
", res=" + res + ']');
+ }
- if (debugMode)
- debugLog("Message has been sent to next node [msg=" + msg +
+ if (debugMode) {
+ debugLog(msg, "Message has been sent to next node [msg=" + msg +
", next=" + next.id() +
", res=" + res + ']');
+ }
}
finally {
clearNodeAddedMessage(msg);
@@ -2635,8 +2723,6 @@ class ServerImpl extends TcpDiscoveryImpl {
next = null;
- searchNext = true;
-
errs = null;
}
else
@@ -2665,25 +2751,30 @@ class ServerImpl extends TcpDiscoveryImpl {
msgWorker.addMessage(new TcpDiscoveryNodeFailedMessage(locNodeId, n.id(), n.internalOrder()));
if (!sent) {
+ assert next == null : next;
+
if (log.isDebugEnabled())
log.debug("Pending messages will be resent to local node");
if (debugMode)
- log.debug("Pending messages will be resent to local node");
+ debugLog(msg, "Pending messages will be resent to local node");
for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs) {
prepareNodeAddedMessage(pendingMsg, locNodeId, pendingMsgs.msgs, pendingMsgs.discardId,
pendingMsgs.customDiscardId);
+ pendingMsg.senderNodeId(locNodeId);
+
msgWorker.addMessage(pendingMsg);
if (log.isDebugEnabled())
log.debug("Pending message has been sent to local node [msg=" + msg.id() +
- ", pendingMsgId=" + pendingMsg + ", next=" + next.id() + ']');
+ ", pendingMsgId=" + pendingMsg + ']');
- if (debugMode)
- debugLog("Pending message has been sent to local node [msg=" + msg.id() +
- ", pendingMsgId=" + pendingMsg + ", next=" + next.id() + ']');
+ if (debugMode) {
+ debugLog(msg, "Pending message has been sent to local node [msg=" + msg.id() +
+ ", pendingMsgId=" + pendingMsg + ']');
+ }
}
}
@@ -3317,15 +3408,17 @@ class ServerImpl extends TcpDiscoveryImpl {
if (sendMessageToRemotes(msg))
sendMessageAcrossRing(msg);
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug("Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage to " +
- "coordinator for final processing [ring=" + ring + ", node=" + node + ", locNode="
- + locNode + ", msg=" + msg + ']');
+ "coordinator for final processing [ring=" + ring + ", node=" + node + ", locNode="
+ + locNode + ", msg=" + msg + ']');
+ }
- if (debugMode)
- debugLog("Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage to " +
- "coordinator for final processing [ring=" + ring + ", node=" + node + ", locNode="
- + locNode + ", msg=" + msg + ']');
+ if (debugMode) {
+ debugLog(msg, "Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage to " +
+ "coordinator for final processing [ring=" + ring + ", node=" + node + ", locNode="
+ + locNode + ", msg=" + msg + ']');
+ }
return;
}
@@ -3338,7 +3431,7 @@ class ServerImpl extends TcpDiscoveryImpl {
", msg=" + msg + ']');
if (debugMode)
- debugLog("Discarding node added message since new node's order is less than " +
+ debugLog(msg, "Discarding node added message since new node's order is less than " +
"max order in ring [ring=" + ring + ", node=" + node + ", locNode=" + locNode +
", msg=" + msg + ']');
@@ -3427,6 +3520,8 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.onExchange(node.id(), node.id(), data, U.gridClassLoader());
msg.addDiscoveryData(locNodeId, spi.collectExchangeData(node.id()));
+
+ processMessageFailedNodes(msg);
}
if (log.isDebugEnabled())
@@ -3447,6 +3542,9 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.gridStartTime = msg.gridStartTime();
for (TcpDiscoveryNode n : top) {
+ assert n.internalOrder() < node.internalOrder() :
+ "Invalid node [topNode=" + n + ", added=" + node + ']';
+
// Make all preceding nodes and local node visible.
n.visible(true);
}
@@ -3500,6 +3598,8 @@ class ServerImpl extends TcpDiscoveryImpl {
for (Map.Entry<UUID, Map<Integer, byte[]>> entry : dataMap.entrySet())
spi.onExchange(node.id(), entry.getKey(), entry.getValue(), U.gridClassLoader());
}
+
+ processMessageFailedNodes(msg);
}
if (sendMessageToRemotes(msg))
@@ -3733,7 +3833,7 @@ class ServerImpl extends TcpDiscoveryImpl {
interruptPing(leavingNode);
- assert leftNode != null;
+ assert leftNode != null : msg;
if (log.isDebugEnabled())
log.debug("Removed node from topology: " + leftNode);
@@ -3887,6 +3987,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
if (node != null) {
+ assert !node.isLocal() : msg;
+
synchronized (mux) {
failedNodes.add(node);
}
@@ -4036,32 +4138,46 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
+ TcpDiscoveryStatusCheckMessage msg0 = msg;
+
+ if (F.contains(msg.failedNodes(), msg.creatorNodeId())) {
+ msg0 = new TcpDiscoveryStatusCheckMessage(msg);
+
+ msg0.failedNodes(null);
+
+ for (UUID failedNodeId : msg.failedNodes()) {
+ if (!failedNodeId.equals(msg.creatorNodeId()))
+ msg0.addFailedNode(failedNodeId);
+ }
+ }
+
try {
- trySendMessageDirectly(msg.creatorNode(), msg);
+ trySendMessageDirectly(msg0.creatorNode(), msg0);
if (log.isDebugEnabled())
log.debug("Responded to status check message " +
- "[recipient=" + msg.creatorNodeId() + ", status=" + msg.status() + ']');
+ "[recipient=" + msg0.creatorNodeId() + ", status=" + msg0.status() + ']');
}
catch (IgniteSpiException e) {
if (e.hasCause(SocketException.class)) {
if (log.isDebugEnabled())
log.debug("Failed to respond to status check message (connection " +
- "refused) [recipient=" + msg.creatorNodeId() + ", status=" +
- msg.status() + ']');
+ "refused) [recipient=" + msg0.creatorNodeId() + ", status=" +
+ msg0.status() + ']');
onException("Failed to respond to status check message (connection refused) " +
- "[recipient=" + msg.creatorNodeId() + ", status=" + msg.status() + ']', e);
+ "[recipient=" + msg0.creatorNodeId() + ", status=" + msg0.status() + ']', e);
}
- else {
- if (pingNode(msg.creatorNode()))
+ else if (!spi.isNodeStopping0()) {
+ if (pingNode(msg0.creatorNode()))
// Node exists and accepts incoming connections.
U.error(log, "Failed to respond to status check message [recipient=" +
- msg.creatorNodeId() + ", status=" + msg.status() + ']', e);
- else if (log.isDebugEnabled())
- log.debug("Failed to respond to status check message (did the node " +
- "stop?) [recipient=" + msg.creatorNodeId() + ", status=" + msg.status()
- + ']');
+ msg0.creatorNodeId() + ", status=" + msg0.status() + ']', e);
+ else if (log.isDebugEnabled()) {
+ log.debug("Failed to respond to status check message (did the node stop?)" +
+ "[recipient=" + msg0.creatorNodeId() +
+ ", status=" + msg0.status() + ']');
+ }
}
}
}
@@ -4364,27 +4480,42 @@ class ServerImpl extends TcpDiscoveryImpl {
*/
private void processCustomMessage(TcpDiscoveryCustomEventMessage msg) {
if (isLocalNodeCoordinator()) {
- if (!joiningNodes.isEmpty()) {
+ boolean delayMsg;
+
+ assert ring.minimumNodeVersion() != null : ring;
+
+ if (ring.minimumNodeVersion().compareTo(CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE) >= 0)
+ delayMsg = msg.topologyVersion() == 0L && !joiningNodes.isEmpty();
+ else
+ delayMsg = !joiningNodes.isEmpty();
+
+ if (delayMsg) {
+ if (log.isDebugEnabled()) {
+ log.debug("Delay custom message processing, there are joining nodes [msg=" + msg +
+ ", joiningNodes=" + joiningNodes + ']');
+ }
+
pendingCustomMsgs.add(msg);
return;
}
- boolean sndNext = !msg.verified();
-
- if (sndNext) {
+ if (!msg.verified()) {
msg.verify(getLocalNodeId());
msg.topologyVersion(ring.topologyVersion());
- if (pendingMsgs.procCustomMsgs.add(msg.id()))
+ if (pendingMsgs.procCustomMsgs.add(msg.id())) {
notifyDiscoveryListener(msg);
- else
- sndNext = false;
- }
- if (sndNext && ring.hasRemoteNodes())
- sendMessageAcrossRing(msg);
+ if (sendMessageToRemotes(msg))
+ sendMessageAcrossRing(msg);
+ else
+ processCustomMessage(msg);
+ }
+ }
else {
+ addMessage(new TcpDiscoveryDiscardMessage(getLocalNodeId(), msg.id(), true));
+
spi.stats.onRingMessageReceived(msg);
DiscoverySpiCustomMessage msgObj = null;
@@ -4401,16 +4532,21 @@ class ServerImpl extends TcpDiscoveryImpl {
if (nextMsg != null) {
try {
- addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), nextMsg,
- spi.marsh.marshal(nextMsg)));
+ TcpDiscoveryCustomEventMessage ackMsg = new TcpDiscoveryCustomEventMessage(
+ getLocalNodeId(), nextMsg, spi.marsh.marshal(nextMsg));
+
+ ackMsg.topologyVersion(msg.topologyVersion());
+
+ processCustomMessage(ackMsg);
+
+ if (ackMsg.verified())
+ msgHist.add(ackMsg);
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to marshal discovery custom message.", e);
}
}
}
-
- addMessage(new TcpDiscoveryDiscardMessage(getLocalNodeId(), msg.id(), true));
}
}
else {
@@ -4428,9 +4564,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
if (msg.verified() && state0 == CONNECTED && pendingMsgs.procCustomMsgs.add(msg.id())) {
- assert joiningNodes.isEmpty() : "Joining nodes: " + joiningNodes + ", msg=" + msg + ", loc=" + locNode.id() +
- ", topver=" + ring.topologyVersion();
- assert msg.topologyVersion() == ring.topologyVersion() : "msg: " + msg + ", topver=" + ring.topologyVersion();
+ assert msg.topologyVersion() == ring.topologyVersion() :
+ "msg: " + msg + ", topVer=" + ring.topologyVersion();
notifyDiscoveryListener(msg);
}
@@ -4441,6 +4576,38 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * Checks failed nodes list and sends {@link TcpDiscoveryNodeFailedMessage} if failed node
+ * is still in the ring.
+ */
+ private void checkFailedNodesList() {
+ List<TcpDiscoveryNodeFailedMessage> msgs = null;
+
+ synchronized (mux) {
+ for (Iterator<TcpDiscoveryNode> it = failedNodes.iterator(); it.hasNext();) {
+ TcpDiscoveryNode node = it.next();
+
+ if (ring.node(node.id()) != null) {
+ if (msgs == null)
+ msgs = new ArrayList<>(failedNodes.size());
+
+ msgs.add(new TcpDiscoveryNodeFailedMessage(getLocalNodeId(), node.id(), node.internalOrder()));
+ }
+ else
+ it.remove();
+ }
+ }
+
+ if (msgs != null) {
+ for (TcpDiscoveryNodeFailedMessage msg : msgs) {
+ if (log.isDebugEnabled())
+ log.debug("Add node failed message for node from failed nodes list: " + msg);
+
+ addMessage(msg);
+ }
+ }
+ }
+
+ /**
* Checks and flushes custom event messages if no nodes are attempting to join the grid.
*/
private void checkPendingCustomMessages() {
@@ -4640,10 +4807,10 @@ class ServerImpl extends TcpDiscoveryImpl {
synchronized (mux) {
readers.add(reader);
-
- reader.start();
}
+ reader.start();
+
spi.stats.onServerSocketInitialized(U.currentTimeMillis() - tstamp);
}
}
@@ -4861,9 +5028,10 @@ class ServerImpl extends TcpDiscoveryImpl {
log.debug("Initialized connection with remote node [nodeId=" + nodeId +
", client=" + req.client() + ']');
- if (debugMode)
- debugLog("Initialized connection with remote node [nodeId=" + nodeId +
+ if (debugMode) {
+ debugLog(msg, "Initialized connection with remote node [nodeId=" + nodeId +
", client=" + req.client() + ']');
+ }
}
catch (IOException e) {
if (log.isDebugEnabled())
@@ -4932,7 +5100,7 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.stats.onMessageReceived(msg);
if (debugMode && recordable(msg))
- debugLog("Message has been received: " + msg);
+ debugLog(msg, "Message has been received: " + msg);
if (msg instanceof TcpDiscoveryConnectionCheckMessage) {
spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
index 2786d0b..1aef728 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
@@ -37,6 +37,7 @@ import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.IgniteSpiThread;
import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
import org.jetbrains.annotations.Nullable;
/**
@@ -99,9 +100,10 @@ abstract class TcpDiscoveryImpl {
}
/**
+ * @param discoMsg Discovery message.
* @param msg Message.
*/
- protected void debugLog(String msg) {
+ protected void debugLog(@Nullable TcpDiscoveryAbstractMessage discoMsg, String msg) {
assert debugMode;
String msg0 = new SimpleDateFormat("[HH:mm:ss,SSS]").format(new Date(System.currentTimeMillis())) +
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
index 7ca092c..eb0f74a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.util.typedef.PN;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteProductVersion;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -88,6 +89,23 @@ public class TcpDiscoveryNodesRing {
@GridToStringExclude
private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
+ /** */
+ private IgniteProductVersion minNodeVer;
+
+ /**
+ * @return Minimum node version.
+ */
+ public IgniteProductVersion minimumNodeVersion() {
+ rwLock.readLock().lock();
+
+ try {
+ return minNodeVer;
+ }
+ finally {
+ rwLock.readLock().unlock();
+ }
+ }
+
/**
* Sets local node.
*
@@ -225,6 +243,8 @@ public class TcpDiscoveryNodesRing {
nodeOrder = node.internalOrder();
maxInternalOrder = node.internalOrder();
+
+ initializeMinimumVersion();
}
finally {
rwLock.writeLock().unlock();
@@ -295,6 +315,8 @@ public class TcpDiscoveryNodesRing {
}
nodeOrder = topVer;
+
+ initializeMinimumVersion();
}
finally {
rwLock.writeLock().unlock();
@@ -341,6 +363,8 @@ public class TcpDiscoveryNodesRing {
nodes.remove(rmv);
}
+ initializeMinimumVersion();
+
return rmv;
}
finally {
@@ -372,6 +396,8 @@ public class TcpDiscoveryNodesRing {
maxInternalOrder = 0;
topVer = 0;
+
+ minNodeVer = locNode.version();
}
finally {
rwLock.writeLock().unlock();
@@ -451,61 +477,8 @@ public class TcpDiscoveryNodesRing {
* topology contains less than two nodes.
*/
@Nullable public TcpDiscoveryNode nextNode(@Nullable Collection<TcpDiscoveryNode> excluded) {
- assert excluded == null || excluded.isEmpty() || !excluded.contains(locNode);
-
- rwLock.readLock().lock();
-
- try {
- Collection<TcpDiscoveryNode> filtered = serverNodes(excluded);
-
- if (filtered.size() < 2)
- return null;
-
- Iterator<TcpDiscoveryNode> iter = filtered.iterator();
-
- while (iter.hasNext()) {
- TcpDiscoveryNode node = iter.next();
-
- if (locNode.equals(node))
- break;
- }
-
- return iter.hasNext() ? iter.next() : F.first(filtered);
- }
- finally {
- rwLock.readLock().unlock();
- }
- }
-
- /**
- * Finds previous node in the topology.
- *
- * @return Previous node.
- */
- @Nullable public TcpDiscoveryNode previousNode() {
- rwLock.readLock().lock();
-
- try {
- if (nodes.size() < 2)
- return null;
-
- return previousNode(null);
- }
- finally {
- rwLock.readLock().unlock();
- }
- }
-
- /**
- * Finds previous node in the topology filtering excluded nodes from search.
- *
- * @param excluded Nodes to exclude from the search (optional). If provided,
- * cannot contain local node.
- * @return Previous node or {@code null} if all nodes were filtered out or
- * topology contains less than two nodes.
- */
- @Nullable public TcpDiscoveryNode previousNode(@Nullable Collection<TcpDiscoveryNode> excluded) {
- assert excluded == null || excluded.isEmpty() || !excluded.contains(locNode);
+ assert locNode.internalOrder() > 0 : locNode;
+ assert excluded == null || excluded.isEmpty() || !excluded.contains(locNode) : excluded;
rwLock.readLock().lock();
@@ -638,6 +611,18 @@ public class TcpDiscoveryNodesRing {
});
}
+ /**
+ *
+ */
+ private void initializeMinimumVersion() {
+ minNodeVer = null;
+
+ for (TcpDiscoveryNode node : nodes) {
+ if (minNodeVer == null || node.version().compareTo(minNodeVer) < 0)
+ minNodeVer = node.version();
+ }
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
rwLock.readLock().lock();
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
index 875d18e..9cb47af 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
@@ -19,10 +19,15 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import java.io.Externalizable;
import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
/**
* Base class to implement discovery messages.
@@ -62,6 +67,10 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
/** Pending message index. */
private short pendingIdx;
+ /** */
+ @GridToStringInclude
+ private Set<UUID> failedNodes;
+
/**
* Default no-arg constructor for {@link Externalizable} interface.
*/
@@ -236,6 +245,34 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
return false;
}
+ /**
+ * Adds node ID to the failed nodes list.
+ *
+ * @param nodeId Node ID.
+ */
+ public void addFailedNode(UUID nodeId) {
+ assert nodeId != null;
+
+ if (failedNodes == null)
+ failedNodes = new HashSet<>();
+
+ failedNodes.add(nodeId);
+ }
+
+ /**
+ * @param failedNodes Failed nodes.
+ */
+ public void failedNodes(@Nullable Set<UUID> failedNodes) {
+ this.failedNodes = failedNodes;
+ }
+
+ /**
+ * @return Failed nodes IDs.
+ */
+ @Nullable public Collection<UUID> failedNodes() {
+ return failedNodes;
+ }
+
/** {@inheritDoc} */
@Override public final boolean equals(Object obj) {
if (this == obj)
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
index 6118f4d..70b0080 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
@@ -62,6 +62,17 @@ public class TcpDiscoveryStatusCheckMessage extends TcpDiscoveryAbstractMessage
}
/**
+ * @param msg Message to copy.
+ */
+ public TcpDiscoveryStatusCheckMessage(TcpDiscoveryStatusCheckMessage msg) {
+ super(msg);
+
+ this.creatorNode = msg.creatorNode;
+ this.failedNodeId = msg.failedNodeId;
+ this.status = msg.status;
+ }
+
+ /**
* Gets creator node.
*
* @return Creator node.
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 55474dc..5053c2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
@@ -212,6 +213,22 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
public void testMultiThreadedClientsServersRestart() throws Throwable {
fail("https://issues.apache.org/jira/browse/IGNITE-1123");
+ multiThreadedClientsServersRestart(GRID_CNT, CLIENT_GRID_CNT);
+ }
+
+ /**
+ * @throws Exception If any error occurs.
+ */
+ public void _testMultiThreadedServersRestart() throws Throwable {
+ multiThreadedClientsServersRestart(GRID_CNT * 2, 0);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @throws Exception If any error occurs.
+ */
+ private void multiThreadedClientsServersRestart(int srvs, int clients) throws Throwable {
final AtomicBoolean done = new AtomicBoolean();
try {
@@ -219,91 +236,95 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
info("Test timeout: " + (getTestTimeout() / (60 * 1000)) + " min.");
- startGridsMultiThreaded(GRID_CNT);
-
- clientFlagGlobal = true;
+ startGridsMultiThreaded(srvs);
- startGridsMultiThreaded(GRID_CNT, CLIENT_GRID_CNT);
+ IgniteInternalFuture<?> clientFut = null;
final AtomicReference<Throwable> error = new AtomicReference<>();
- final BlockingQueue<Integer> clientStopIdxs = new LinkedBlockingQueue<>();
-
- for (int i = GRID_CNT; i < GRID_CNT + CLIENT_GRID_CNT; i++)
- clientStopIdxs.add(i);
+ if (clients > 0) {
+ clientFlagGlobal = true;
- final AtomicInteger clientStartIdx = new AtomicInteger(9000);
+ startGridsMultiThreaded(srvs, clients);
- IgniteInternalFuture<?> fut1 = multithreadedAsync(
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- try {
- clientFlagPerThread.set(true);
+ final BlockingQueue<Integer> clientStopIdxs = new LinkedBlockingQueue<>();
- while (!done.get() && error.get() == null) {
- Integer stopIdx = clientStopIdxs.take();
+ for (int i = srvs; i < srvs + clients; i++)
+ clientStopIdxs.add(i);
- log.info("Stop client: " + stopIdx);
+ final AtomicInteger clientStartIdx = new AtomicInteger(9000);
- stopGrid(stopIdx);
+ clientFut = multithreadedAsync(
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try {
+ clientFlagPerThread.set(true);
while (!done.get() && error.get() == null) {
- // Generate unique name to simplify debugging.
- int startIdx = clientStartIdx.getAndIncrement();
+ Integer stopIdx = clientStopIdxs.take();
- log.info("Start client: " + startIdx);
+ log.info("Stop client: " + stopIdx);
- UUID id = UUID.randomUUID();
+ stopGrid(stopIdx);
- nodeId.set(id);
+ while (!done.get() && error.get() == null) {
+ // Generate unique name to simplify debugging.
+ int startIdx = clientStartIdx.getAndIncrement();
- try {
- Ignite ignite = startGrid(startIdx);
+ log.info("Start client: " + startIdx);
- assertTrue(ignite.configuration().isClientMode());
+ UUID id = UUID.randomUUID();
- clientStopIdxs.add(startIdx);
+ nodeId.set(id);
- break;
- }
- catch (Exception e) {
- if (X.hasCause(e, IgniteClientDisconnectedCheckedException.class) ||
- X.hasCause(e, IgniteClientDisconnectedException.class))
- log.info("Client disconnected: " + e);
- else if (X.hasCause(e, ClusterTopologyCheckedException.class))
- log.info("Client failed to start: " + e);
- else {
- if (failedNodes.contains(id) && X.hasCause(e, IgniteSpiException.class))
- log.info("Client failed: " + e);
- else
- throw e;
+ try {
+ Ignite ignite = startGrid(startIdx);
+
+ assertTrue(ignite.configuration().isClientMode());
+
+ clientStopIdxs.add(startIdx);
+
+ break;
+ }
+ catch (Exception e) {
+ if (X.hasCause(e, IgniteClientDisconnectedCheckedException.class) ||
+ X.hasCause(e, IgniteClientDisconnectedException.class))
+ log.info("Client disconnected: " + e);
+ else if (X.hasCause(e, ClusterTopologyCheckedException.class))
+ log.info("Client failed to start: " + e);
+ else {
+ if (failedNodes.contains(id) && X.hasCause(e, IgniteSpiException.class))
+ log.info("Client failed: " + e);
+ else
+ throw e;
+ }
}
}
}
}
- }
- catch (Throwable e) {
- log.error("Unexpected error: " + e, e);
+ catch (Throwable e) {
+ log.error("Unexpected error: " + e, e);
- error.compareAndSet(null, e);
+ error.compareAndSet(null, e);
+
+ return null;
+ }
return null;
}
-
- return null;
- }
- },
- CLIENT_GRID_CNT,
- "client-restart");
+ },
+ clients,
+ "client-restart");
+ }
final BlockingQueue<Integer> srvStopIdxs = new LinkedBlockingQueue<>();
- for (int i = 0; i < GRID_CNT; i++)
+ for (int i = 0; i < srvs; i++)
srvStopIdxs.add(i);
- final AtomicInteger srvStartIdx = new AtomicInteger(GRID_CNT + CLIENT_GRID_CNT);
+ final AtomicInteger srvStartIdx = new AtomicInteger(srvs + clients);
- IgniteInternalFuture<?> fut2 = multithreadedAsync(
+ IgniteInternalFuture<?> srvFut = multithreadedAsync(
new Callable<Object>() {
@Override public Object call() throws Exception {
try {
@@ -312,6 +333,10 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
while (!done.get() && error.get() == null) {
int stopIdx = srvStopIdxs.take();
+ U.sleep(50);
+
+ Thread.currentThread().setName("stop-server-" + getTestGridName(stopIdx));
+
log.info("Stop server: " + stopIdx);
stopGrid(stopIdx);
@@ -319,13 +344,20 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
// Generate unique name to simplify debugging.
int startIdx = srvStartIdx.getAndIncrement();
+ Thread.currentThread().setName("start-server-" + getTestGridName(startIdx));
+
log.info("Start server: " + startIdx);
- Ignite ignite = startGrid(startIdx);
+ try {
+ Ignite ignite = startGrid(startIdx);
- assertFalse(ignite.configuration().isClientMode());
+ assertFalse(ignite.configuration().isClientMode());
- srvStopIdxs.add(startIdx);
+ srvStopIdxs.add(startIdx);
+ }
+ catch (IgniteCheckedException e) {
+ log.info("Failed to start: " + e);
+ }
}
}
catch (Throwable e) {
@@ -339,7 +371,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
return null;
}
},
- GRID_CNT - 1,
+ srvs - 1,
"server-restart");
final long timeToExec = getTestTimeout() - 60_000;
@@ -356,8 +388,10 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
done.set(true);
- fut1.cancel();
- fut2.cancel();
+ if (clientFut != null)
+ clientFut.cancel();
+
+ srvFut.cancel();
throw err;
}
@@ -367,8 +401,10 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
done.set(true);
- fut1.get();
- fut2.get();
+ if (clientFut != null)
+ clientFut.get();
+
+ srvFut.get();
}
finally {
done.set(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
index 8b94f54..7beeb41 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -196,8 +197,15 @@ public class TcpDiscoveryRestartTest extends GridCommonAbstractTest {
/**
* @param nodeId Node ID.
+ * @throws Exception If failed.
*/
- void checkEvents(UUID nodeId) {
+ void checkEvents(final UUID nodeId) throws Exception {
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return joinIds.contains(nodeId) && leftIds.contains(nodeId);
+ }
+ }, 5000);
+
assertTrue("No join event: " + nodeId, joinIds.contains(nodeId));
assertTrue("No left event: " + nodeId, leftIds.contains(nodeId));
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 51d8a2d..379a3a6 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -21,16 +21,19 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
+import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -38,6 +41,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteIllegalStateException;
+import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
@@ -46,12 +51,16 @@ import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.processors.continuous.StartRoutineAckDiscoveryMessage;
import org.apache.ignite.internal.processors.port.GridPortRecord;
import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.IgniteSpiException;
@@ -64,8 +73,8 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryPingResponse;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
@@ -94,7 +103,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
private UUID nodeId;
/** */
- private TcpDiscoverySpi nodeSpi;
+ private static ThreadLocal<TcpDiscoverySpi> nodeSpi = new ThreadLocal<>();
/**
* @throws Exception If fails.
@@ -104,15 +113,17 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @SuppressWarnings({"IfMayBeConditional", "deprecation"})
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- TcpDiscoverySpi spi = nodeSpi;
+ TcpDiscoverySpi spi = nodeSpi.get();
- if (spi == null)
+ if (spi == null) {
spi = gridName.contains("testPingInterruptedOnNodeFailedFailingNode") ?
new TestTcpDiscoverySpi() : new TcpDiscoverySpi();
+ }
+ else
+ nodeSpi.set(null);
discoMap.put(gridName, spi);
@@ -176,6 +187,13 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ discoMap = null;
+
+ super.afterTest();
+ }
+
/**
* @throws Exception If any error occurs.
*/
@@ -1202,11 +1220,11 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
private void customEventRace1(final boolean cacheStartFrom1, boolean stopCrd) throws Exception {
TestCustomEventRaceSpi spi0 = new TestCustomEventRaceSpi();
- nodeSpi = spi0;
+ nodeSpi.set(spi0);
final Ignite ignite0 = startGrid(0);
- nodeSpi = new TestCustomEventRaceSpi();
+ nodeSpi.set(new TestCustomEventRaceSpi());
final Ignite ignite1 = startGrid(1);
@@ -1221,7 +1239,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
@Override public Void call() throws Exception {
log.info("Start 2");
- nodeSpi = new TestCustomEventRaceSpi();
+ nodeSpi.set(new TestCustomEventRaceSpi());
Ignite ignite2 = startGrid(2);
@@ -1271,7 +1289,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
assertEquals(1, cache.get(1));
- nodeSpi = new TestCustomEventRaceSpi();
+ nodeSpi.set(new TestCustomEventRaceSpi());
Ignite ignite = startGrid(3);
@@ -1314,15 +1332,15 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
private void customEventCoordinatorFailure(boolean twoNodes) throws Exception {
TestCustomEventCoordinatorFailureSpi spi0 = new TestCustomEventCoordinatorFailureSpi();
- nodeSpi = spi0;
+ nodeSpi.set(spi0);
Ignite ignite0 = startGrid(0);
- nodeSpi = new TestCustomEventCoordinatorFailureSpi();
+ nodeSpi.set(new TestCustomEventCoordinatorFailureSpi());
Ignite ignite1 = startGrid(1);
- nodeSpi = new TestCustomEventCoordinatorFailureSpi();
+ nodeSpi.set(new TestCustomEventCoordinatorFailureSpi());
Ignite ignite2 = twoNodes ? null : startGrid(2);
@@ -1366,7 +1384,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
log.info("Try start one more node.");
- nodeSpi = new TestCustomEventCoordinatorFailureSpi();
+ nodeSpi.set(new TestCustomEventCoordinatorFailureSpi());
Ignite ignite = startGrid(twoNodes ? 2 : 3);
@@ -1381,6 +1399,421 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/**
+ * Coordinator is added in failed list during node start.
+ *
+ * @throws Exception If failed.
+ */
+ public void testFailedNodes1() throws Exception {
+ try {
+ final int FAIL_ORDER = 3;
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ final Ignite ignite0 = startGrid(0);
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ startGrid(1);
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ Ignite ignite2 = startGrid(2);
+
+ assertEquals(2, ignite2.cluster().nodes().size());
+
+ waitNodeStop(ignite0.name());
+
+ tryCreateCache(2);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Coordinator is added in failed list, concurrent nodes start.
+ *
+ * @throws Exception If failed.
+ */
+ public void testFailedNodes2() throws Exception {
+ try {
+ final int FAIL_ORDER = 3;
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ Ignite ignite0 = startGrid(0);
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ startGrid(1);
+
+ final AtomicInteger nodeIdx = new AtomicInteger(1);
+
+ GridTestUtils.runMultiThreaded(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int idx = nodeIdx.incrementAndGet();
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ startGrid(idx);
+
+ return null;
+ }
+ }, 3, "start-node");
+
+ Ignite ignite2 = ignite(2);
+
+ waitForRemoteNodes(ignite2, 3);
+
+ waitNodeStop(ignite0.name());
+
+ tryCreateCache(4);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Coordinator is added in failed list during node start, test with two nodes.
+ *
+ * @throws Exception If failed.
+ */
+ public void testFailedNodes3() throws Exception {
+ try {
+ nodeSpi.set(new TestFailedNodesSpi(-1));
+
+ Ignite ignite0 = startGrid(0);
+
+ nodeSpi.set(new TestFailedNodesSpi(2));
+
+ Ignite ignite1 = startGrid(1);
+
+ assertEquals(1, ignite1.cluster().nodes().size());
+
+ waitNodeStop(ignite0.name());
+
+ ignite1.getOrCreateCache(new CacheConfiguration<>()).put(1, 1);
+
+ startGrid(2);
+
+ assertEquals(2, ignite1.cluster().nodes().size());
+
+ tryCreateCache(2);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Coordinator is added in failed list during node start, but node detected failure dies before
+ * sending {@link TcpDiscoveryNodeFailedMessage}.
+ *
+ * @throws Exception If failed.
+ */
+ public void testFailedNodes4() throws Exception {
+ try {
+ final int FAIL_ORDER = 3;
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ final Ignite ignite0 = startGrid(0);
+
+ nodeSpi.set(new TestFailedNodesSpi(FAIL_ORDER));
+
+ Ignite ignite1 = startGrid(1);
+
+ TestFailedNodesSpi spi = new TestFailedNodesSpi(FAIL_ORDER);
+
+ spi.stopBeforeSndFail = true;
+
+ nodeSpi.set(spi);
+
+ Ignite ignite2 = startGrid(2);
+
+ waitNodeStop(ignite2.name());
+
+ log.info("Try start new node.");
+
+ Ignite ignite3 = startGrid(3);
+
+ waitNodeStop(ignite0.name());
+
+ assertEquals(2, ignite1.cluster().nodes().size());
+ assertEquals(2, ignite3.cluster().nodes().size());
+
+ tryCreateCache(2);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Adds some node in failed list after join process finished.
+ *
+ * @throws Exception If failed.
+ */
+ public void testFailedNodes5() throws Exception {
+ try {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ for (int iter = 0; iter < 3; iter++) {
+ final int NODES = iter == 0 ? 2 : rnd.nextInt(3, 6);
+
+ for (int i = 0; i < NODES; i++) {
+ nodeSpi.set(new TestFailedNodesSpi(-1));
+
+ startGrid(i);
+ }
+
+ Map<Long, Ignite> nodes = new HashMap<>();
+
+ for (int i = 0; i < NODES; i++) {
+ Ignite ignite = ignite(i);
+
+ nodes.put(ignite.cluster().localNode().order(), ignite);
+ }
+
+ Ignite ignite = ignite(rnd.nextInt(NODES));
+
+ log.info("Iteration [iter=" + iter + ", nodes=" + NODES + ", failFrom=" + ignite.name() + ']');
+
+ TestFailedNodesSpi spi = (TestFailedNodesSpi)ignite.configuration().getDiscoverySpi();
+
+ spi.failSingleMsg = true;
+
+ long order = ignite.cluster().localNode().order();
+
+ long nextOrder = order == NODES ? 1 : order + 1;
+
+ Ignite failingNode = nodes.get(nextOrder);
+
+ assertNotNull(failingNode);
+
+ waitNodeStop(failingNode.name());
+
+ Ignite newNode = startGrid(NODES);
+
+ assertEquals(NODES, newNode.cluster().nodes().size());
+
+ tryCreateCache(NODES);
+
+ stopAllGrids();
+ }
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCustomEventAckNotSend() throws Exception {
+ try {
+ TestCustomerEventAckSpi spi0 = new TestCustomerEventAckSpi();
+
+ nodeSpi.set(spi0);
+
+ Ignite ignite0 = startGrid(0);
+
+ nodeSpi.set(new TestCustomerEventAckSpi());
+
+ Ignite ignite1 = startGrid(1);
+
+ spi0.stopBeforeSndAck = true;
+
+ ignite1.message().remoteListen("test", new DummyPredicate());
+
+ waitNodeStop(ignite0.name());
+
+ startGrid(2);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @param nodeName Node name.
+ * @throws Exception If failed.
+ */
+ private void waitNodeStop(final String nodeName) throws Exception {
+ boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ try {
+ Ignition.ignite(nodeName);
+
+ return false;
+ }
+ catch (IgniteIllegalStateException e) {
+ return true;
+ }
+ }
+ }, 10_000);
+
+ if (!wait)
+ U.dumpThreads(log);
+
+ assertTrue("Failed to wait for node stop.", wait);
+ }
+
+ /**
+ * @param expNodes Expected nodes number.
+ */
+ private void tryCreateCache(int expNodes) {
+ List<Ignite> allNodes = G.allGrids();
+
+ assertEquals(expNodes, allNodes.size());
+
+ int cntr = 0;
+
+ for (Ignite ignite : allNodes) {
+ CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+ ccfg.setName("cache-" + cntr++);
+
+ log.info("Try create cache [node=" + ignite.name() + ", cache=" + ccfg.getName() + ']');
+
+ ignite.getOrCreateCache(ccfg).put(1, 1);
+ }
+ }
+
+ /**
+ *
+ */
+ static class DummyPredicate implements IgniteBiPredicate<UUID, Object> {
+ /** {@inheritDoc} */
+ @Override public boolean apply(UUID uuid, Object o) {
+ return true;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCustomerEventAckSpi extends TcpDiscoverySpi {
+ /** */
+ private volatile boolean stopBeforeSndAck;
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(Socket sock,
+ TcpDiscoveryAbstractMessage msg,
+ GridByteArrayOutputStream bout,
+ long timeout) throws IOException, IgniteCheckedException {
+ if (stopBeforeSndAck) {
+ if (msg instanceof TcpDiscoveryCustomEventMessage) {
+ try {
+ DiscoveryCustomMessage custMsg = GridTestUtils.getFieldValue(
+ ((TcpDiscoveryCustomEventMessage)msg).message(marsh), "delegate");
+
+ if (custMsg instanceof StartRoutineAckDiscoveryMessage) {
+ log.info("Skip message send and stop node: " + msg);
+
+ sock.close();
+
+ GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ ignite.close();
+
+ return null;
+ }
+ }, "stop-node");
+
+ return;
+ }
+ }
+ catch (Throwable e) {
+ fail("Unexpected error: " + e);
+ }
+ }
+ }
+
+ super.writeToSocket(sock, msg, bout, timeout);
+ }
+ }
+
+ /**
+ * Simulate scenario when node detects node failure trying to send message, but node still alive.
+ */
+ private static class TestFailedNodesSpi extends TcpDiscoverySpi {
+ /** */
+ private AtomicBoolean failMsg = new AtomicBoolean();
+
+ /** */
+ private int failOrder;
+
+ /** */
+ private boolean stopBeforeSndFail;
+
+ /** */
+ private boolean stop;
+
+ /** */
+ private volatile boolean failSingleMsg;
+
+ /**
+ * @param failOrder Spi fails connection if local node order equals to this order.
+ */
+ TestFailedNodesSpi(int failOrder) {
+ this.failOrder = failOrder;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(Socket sock,
+ TcpDiscoveryAbstractMessage msg,
+ GridByteArrayOutputStream bout,
+ long timeout) throws IOException, IgniteCheckedException {
+ if (stop)
+ return;
+
+ if (failSingleMsg) {
+ failSingleMsg = false;
+
+ log.info("IO error on message send [locNode=" + locNode + ", msg=" + msg + ']');
+
+ sock.close();
+
+ throw new SocketTimeoutException();
+ }
+
+ if (locNode.internalOrder() == failOrder &&
+ (msg instanceof TcpDiscoveryNodeAddedMessage) &&
+ failMsg.compareAndSet(false, true)) {
+ log.info("IO error on message send [locNode=" + locNode + ", msg=" + msg + ']');
+
+ sock.close();
+
+ throw new SocketTimeoutException();
+ }
+
+ if (stopBeforeSndFail &&
+ locNode.internalOrder() == failOrder &&
+ (msg instanceof TcpDiscoveryNodeFailedMessage)) {
+ stop = true;
+
+ log.info("Skip messages send and stop node [locNode=" + locNode + ", msg=" + msg + ']');
+
+ sock.close();
+
+ GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ ignite.close();
+
+ return null;
+ }
+ }, "stop-node");
+
+ return;
+ }
+
+ super.writeToSocket(sock, msg, bout, timeout);
+ }
+ }
+
+ /**
*
*/
private static class TestCustomEventCoordinatorFailureSpi extends TcpDiscoverySpi {
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
index 97ba5cf..1e710ee 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
@@ -58,14 +58,20 @@ public class TcpDiscoveryMulticastIpFinderSelfTest
try {
ipFinder1 = ipFinder();
+ ipFinder1.setResponseWaitTime(1000);
+ ipFinder1.setAddressRequestAttempts(10);
ipFinder2 = new TcpDiscoveryMulticastIpFinder();
+ ipFinder2.setResponseWaitTime(1000);
+ ipFinder2.setAddressRequestAttempts(10);
ipFinder2.setMulticastGroup(ipFinder1.getMulticastGroup());
ipFinder2.setMulticastPort(ipFinder1.getMulticastPort());
ipFinder3 = new TcpDiscoveryMulticastIpFinder();
+ ipFinder3.setResponseWaitTime(1000);
+ ipFinder3.setAddressRequestAttempts(10);
ipFinder3.setMulticastGroup(ipFinder1.getMulticastGroup());
ipFinder3.setMulticastPort(ipFinder1.getMulticastPort());
@@ -81,21 +87,13 @@ public class TcpDiscoveryMulticastIpFinderSelfTest
ipFinder2.initializeLocalAddresses(Collections.singleton(new InetSocketAddress("host2", 1002)));
ipFinder3.initializeLocalAddresses(Collections.singleton(new InetSocketAddress("host3", 1003)));
- for (int i = 0; i < 5; i++) {
- Collection<InetSocketAddress> addrs1 = ipFinder1.getRegisteredAddresses();
- Collection<InetSocketAddress> addrs2 = ipFinder2.getRegisteredAddresses();
- Collection<InetSocketAddress> addrs3 = ipFinder3.getRegisteredAddresses();
-
- if (addrs1.size() != 1 || addrs2.size() != 2 || addrs3.size() != 3) {
- info("Addrs1: " + addrs1);
- info("Addrs2: " + addrs2);
- info("Addrs2: " + addrs3);
-
- Thread.sleep(1000);
- }
- else
- break;
- }
+ Collection<InetSocketAddress> addrs1 = ipFinder1.getRegisteredAddresses();
+ Collection<InetSocketAddress> addrs2 = ipFinder2.getRegisteredAddresses();
+ Collection<InetSocketAddress> addrs3 = ipFinder3.getRegisteredAddresses();
+
+ info("Addrs1: " + addrs1);
+ info("Addrs2: " + addrs2);
+ info("Addrs2: " + addrs3);
assertEquals(1, ipFinder1.getRegisteredAddresses().size());
assertEquals(2, ipFinder2.getRegisteredAddresses().size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/80147128/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 41d4b4a..3e41979 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -1120,16 +1120,31 @@ public abstract class GridAbstractTest extends TestCase {
if (gridName != null && gridName.matches(".*\\d")) {
String idStr = UUID.randomUUID().toString();
- char[] chars = idStr.toCharArray();
+ if (gridName.startsWith(getTestGridName())) {
+ String idxStr = String.valueOf(getTestGridIndex(gridName));
- chars[0] = gridName.charAt(gridName.length() - 1);
- chars[1] = '0';
+ while (idxStr.length() < 5)
+ idxStr = '0' + idxStr;
- chars[chars.length - 3] = '0';
- chars[chars.length - 2] = '0';
- chars[chars.length - 1] = gridName.charAt(gridName.length() - 1);
+ char[] chars = idStr.toCharArray();
- cfg.setNodeId(UUID.fromString(new String(chars)));
+ for (int i = 0; i < idxStr.length(); i++)
+ chars[chars.length - idxStr.length() + i] = idxStr.charAt(i);
+
+ cfg.setNodeId(UUID.fromString(new String(chars)));
+ }
+ else {
+ char[] chars = idStr.toCharArray();
+
+ chars[0] = gridName.charAt(gridName.length() - 1);
+ chars[1] = '0';
+
+ chars[chars.length - 3] = '0';
+ chars[chars.length - 2] = '0';
+ chars[chars.length - 1] = gridName.charAt(gridName.length() - 1);
+
+ cfg.setNodeId(UUID.fromString(new String(chars)));
+ }
}
if (isMultiJvm())
[06/50] [abbrv] ignite git commit: ignite-1.5 Fixed benchmark config.
Posted by vo...@apache.org.
ignite-1.5 Fixed benchmark config.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9396ccb7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9396ccb7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9396ccb7
Branch: refs/heads/ignite-1816
Commit: 9396ccb74f5136a60c68e2de451340281458c0ed
Parents: 7ba2efb
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Nov 10 17:52:36 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Nov 10 17:53:46 2015 +0700
----------------------------------------------------------------------
.../yardstick/config/ignite-store-config.xml | 31 +++++++++++---------
1 file changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9396ccb7/modules/yardstick/config/ignite-store-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-store-config.xml b/modules/yardstick/config/ignite-store-config.xml
index d233455..35b8e19 100644
--- a/modules/yardstick/config/ignite-store-config.xml
+++ b/modules/yardstick/config/ignite-store-config.xml
@@ -30,14 +30,9 @@
<!--
Store data source.
-->
- <bean id="storeDataSource" class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
- <property name="dataSource">
- <bean class="org.h2.jdbcx.JdbcConnectionPool" factory-method="create">
- <constructor-arg value="jdbc:h2:tcp://localhost/store-benchmark/h2-benchmark"/>
- <constructor-arg value="sa"/>
- <constructor-arg value=""/>
- </bean>
- </property>
+ <bean id="storeDataSource" class="org.h2.jdbcx.JdbcDataSource">
+ <property name="url" value="jdbc:h2:tcp://localhost/store-benchmark/h2-benchmark"/>
+ <property name="user" value="sa"/>
</bean>
<bean id="sampleTypeMetadata" class="org.apache.ignite.cache.CacheTypeMetadata">
@@ -70,7 +65,7 @@
</property>
</bean>
- <bean class="org.apache.ignite.configuration.IgniteConfiguration" >
+ <bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="peerClassLoadingEnabled" value="false"/>
<property name="cacheConfiguration">
@@ -91,8 +86,11 @@
</property>
<property name="cacheStoreFactory">
- <bean class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
- <constructor-arg ref="storeDataSource"/>
+ <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
+ <property name="dataSourceBean" value="storeDataSource"/>
+ <property name="dialect">
+ <bean class="org.apache.ignite.cache.store.jdbc.dialect.H2Dialect"/>
+ </property>
</bean>
</property>
</bean>
@@ -113,15 +111,20 @@
</property>
<property name="cacheStoreFactory">
- <bean class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
- <constructor-arg ref="storeDataSource"/>
+ <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
+ <property name="dataSourceBean" value="storeDataSource"/>
+ <property name="dialect">
+ <bean class="org.apache.ignite.cache.store.jdbc.dialect.H2Dialect"/>
+ </property>
</bean>
</property>
</bean>
</list>
</property>
- <property name="connectorConfiguration"><null/></property>
+ <property name="connectorConfiguration">
+ <null/>
+ </property>
<property name="includeEventTypes">
<list/>
[16/50] [abbrv] ignite git commit: Disabled failing tests.
Posted by vo...@apache.org.
Disabled failing tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d567d259
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d567d259
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d567d259
Branch: refs/heads/ignite-1816
Commit: d567d2595cc95c5a27e43d1331b9dd523dc67be7
Parents: 3de9d47
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 11 10:19:48 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 11 10:19:48 2015 +0300
----------------------------------------------------------------------
.../dht/IgniteCachePutRetryTransactionalSelfTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d567d259/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 f61faf2..7655464 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
@@ -88,6 +88,16 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
}
}
+ /** {@inheritDoc} */
+ @Override public void testGetAndPut() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1525");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testInvoke() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1525");
+ }
+
/**
* @throws Exception If failed.
*/
[27/50] [abbrv] ignite git commit: Improve IgnitePutGetTxBenchmark
Posted by vo...@apache.org.
Improve IgnitePutGetTxBenchmark
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5a116cb2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5a116cb2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5a116cb2
Branch: refs/heads/ignite-1816
Commit: 5a116cb264a8834840fde8e5e8a60d06023d6b1a
Parents: c9cea76
Author: ashutak <as...@gridgain.com>
Authored: Fri Nov 13 16:23:56 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Nov 13 16:23:56 2015 +0300
----------------------------------------------------------------------
.../config/benchmark-multicast.properties | 4 +-
.../yardstick/IgniteBenchmarkArguments.java | 2 +-
.../cache/IgnitePutGetTxBenchmark.java | 41 +++++++++++++++-----
3 files changed, 35 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a116cb2/modules/yardstick/config/benchmark-multicast.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-multicast.properties b/modules/yardstick/config/benchmark-multicast.properties
index c508471..85f6c11 100644
--- a/modules/yardstick/config/benchmark-multicast.properties
+++ b/modules/yardstick/config/benchmark-multicast.properties
@@ -90,7 +90,9 @@ CONFIGS="\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutBenchmark -sn IgniteNode -ds ${ver}atomic-put-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutGetBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutTxBenchmark -sn IgniteNode -ds ${ver}tx-put-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -txc OPTIMISTIC -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-optim-repRead-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -txc PESSIMISTIC -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-pessim-repRead-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -txc OPTIMISTIC -txi SERIALIZABLE -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-opt-serial-put-get-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryJoinBenchmark -sn IgniteNode -ds ${ver}sql-query-join-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds ${ver}sql-query-put-1-backup,\
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a116cb2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 74b1da9..1ecfa0f 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -62,7 +62,7 @@ public class IgniteBenchmarkArguments {
/** */
@Parameter(names = {"-txc", "--txConcurrency"}, description = "Transaction concurrency")
- private TransactionConcurrency txConcurrency = TransactionConcurrency.OPTIMISTIC;
+ private TransactionConcurrency txConcurrency = TransactionConcurrency.PESSIMISTIC;
/** */
@Parameter(names = {"-txi", "--txIsolation"}, description = "Transaction isolation")
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a116cb2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
index 5afe0b2..3235721 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
@@ -18,28 +18,49 @@
package org.apache.ignite.yardstick.cache;
import java.util.Map;
+import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.IgniteTransactions;
import org.apache.ignite.yardstick.cache.model.SampleValue;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.apache.ignite.yardstick.IgniteBenchmarkUtils.doInTransaction;
/**
* Ignite benchmark that performs transactional put and get operations.
*/
public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
+ /** */
+ private IgniteTransactions txs;
+
+ /** */
+ private Callable<Void> clo;
+
/** {@inheritDoc} */
- @Override public boolean test(Map<Object, Object> ctx) throws Exception {
- int key = nextRandom(0, args.range() / 2);
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ txs = ignite().transactions();
- try (Transaction tx = ignite().transactions().txStart()) {
- Object val = cache.get(key);
+ clo = new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int key = nextRandom(0, args.range() / 2);
- if (val != null)
- key = nextRandom(args.range() / 2, args.range());
+ Object val = cache.get(key);
- cache.put(key, new SampleValue(key));
+ if (val != null)
+ key = nextRandom(args.range() / 2, args.range());
- tx.commit();
- }
+ cache.put(key, new SampleValue(key));
+
+ return null;
+ }
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ doInTransaction(txs, args.txConcurrency(), args.txIsolation(), clo);
return true;
}
[03/50] [abbrv] ignite git commit: ignite-1817 Deprecate
RandomEvictionPolicy and IgniteCache.randomEntry method - Fixes #191.
Posted by vo...@apache.org.
ignite-1817 Deprecate RandomEvictionPolicy and IgniteCache.randomEntry method - Fixes #191.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3de9d47a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3de9d47a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3de9d47a
Branch: refs/heads/ignite-1816
Commit: 3de9d47a88d2e13c4807e44e2c391549929d3c9d
Parents: 5e36b26
Author: agura <ag...@gridgain.com>
Authored: Mon Nov 9 20:36:53 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Nov 9 20:36:53 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCache.java | 1 +
.../eviction/random/RandomEvictionPolicy.java | 4 ++++
.../processors/cache/GridCacheAdapter.java | 22 ++++++++++++++++----
.../processors/cache/IgniteCacheProxy.java | 6 ++++++
4 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3de9d47a/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 5558a26..6c4b507 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -104,6 +104,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
*
* @return Random entry, or {@code null} if cache is empty.
*/
+ @Deprecated
public Entry<K, V> randomEntry();
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/3de9d47a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
index bf04d92..f77551d 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
@@ -39,7 +39,11 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE
* <p>
* Random eviction will provide the best performance over any key queue in which every
* key has the same probability of being accessed.
+ *
+ * @deprecated This eviction policy implementation doesn't support near cache
+ * and doesn't work on client nodes. Also it seems that random eviction doesn't make sense.
*/
+@Deprecated
public class RandomEvictionPolicy<K, V> implements EvictionPolicy<K, V>, RandomEvictionPolicyMBean, Externalizable {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3de9d47a/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 74951b5..419ccec 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
@@ -99,7 +99,6 @@ import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
import org.apache.ignite.internal.util.F0;
-import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -122,7 +121,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.GPC;
import org.apache.ignite.internal.util.typedef.internal.S;
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.IgniteCallable;
@@ -3526,10 +3524,26 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* @return Random cache entry.
*/
+ @Deprecated
@Nullable public Cache.Entry<K, V> randomEntry() {
- GridCacheMapEntry e = map.randomEntry();
+ GridCacheMapEntry entry;
- return e == null || e.obsolete() ? null : e.<K, V>wrapLazyValue();
+ if (ctx.offheapTiered()) {
+ Iterator<Cache.Entry<K, V>> it;
+
+ try {
+ it = ctx.swap().offheapIterator(true, true, ctx.affinity().affinityTopologyVersion());
+ }
+ catch (IgniteCheckedException e) {
+ throw CU.convertToCacheException(e);
+ }
+
+ return it.hasNext() ? it.next() : null;
+ }
+ else
+ entry = map.randomEntry();
+
+ return entry == null || entry.obsolete() ? null : entry.<K, V>wrapLazyValue();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/3de9d47a/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 c563e59..4b03bb9 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
@@ -61,6 +61,7 @@ import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.AsyncSupportAdapter;
+import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQuery;
@@ -276,6 +277,11 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Nullable @Override public Cache.Entry<K, V> randomEntry() {
+ GridKernalContext kctx = ctx.kernalContext();
+
+ if (kctx.isDaemon() || kctx.clientNode())
+ throw new UnsupportedOperationException("Not applicable for daemon or client node.");
+
GridCacheGateway<K, V> gate = this.gate;
CacheOperationContext prev = onEnter(gate, opCtx);
[20/50] [abbrv] ignite git commit: Added tx-getAll PutAll benchmarks
Posted by vo...@apache.org.
Added tx-getAll PutAll benchmarks
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/847b616f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/847b616f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/847b616f
Branch: refs/heads/ignite-1816
Commit: 847b616f1a15756db8876fc8f88b0629318f14c3
Parents: 967cfcb
Author: ashutak <as...@gridgain.com>
Authored: Wed Nov 11 18:35:02 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Wed Nov 11 18:35:02 2015 +0300
----------------------------------------------------------------------
.../config/benchmark-multicast.properties | 5 +-
.../ignite/yardstick/IgniteBenchmarkUtils.java | 75 ++++++++++++++++++++
.../IgniteAccountSerializableTxBenchmark.java | 11 ++-
.../cache/IgniteAccountTxBenchmark.java | 11 ++-
.../cache/IgniteGetAllPutAllTxBenchmark.java | 73 +++++++++++++++++++
...IgniteTransactionalWriteInvokeBenchmark.java | 41 +----------
.../IgniteTransactionalWriteReadBenchmark.java | 41 +----------
7 files changed, 166 insertions(+), 91 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/config/benchmark-multicast.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-multicast.properties b/modules/yardstick/config/benchmark-multicast.properties
index 536ccf4..577d611 100644
--- a/modules/yardstick/config/benchmark-multicast.properties
+++ b/modules/yardstick/config/benchmark-multicast.properties
@@ -110,5 +110,8 @@ CONFIGS="\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-put-offheap-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-1-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-1-backup\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc OPTIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-optimistic-getAllPutAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc PESSIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-pessimistic-getAllPutAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 10 -txc OPTIMISTIC -txi SERIALIZABLE -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds tx-opt-serializable-getAllPutAll-1-backup,\
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkUtils.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkUtils.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkUtils.java
new file mode 100644
index 0000000..0b7568b
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkUtils.java
@@ -0,0 +1,75 @@
+/*
+ * 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.yardstick;
+
+import java.util.concurrent.Callable;
+import javax.cache.CacheException;
+import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.cluster.ClusterTopologyException;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.apache.ignite.transactions.TransactionOptimisticException;
+import org.apache.ignite.transactions.TransactionRollbackException;
+
+/**
+ * Utils.
+ */
+public class IgniteBenchmarkUtils {
+ /**
+ * Utility class constructor.
+ */
+ private IgniteBenchmarkUtils() {
+ // No-op.
+ }
+
+ /**
+ * @param igniteTx Ignite transaction.
+ * @param txConcurrency Transaction concurrency.
+ * @param clo Closure.
+ * @return Result of closure execution.
+ * @throws Exception
+ */
+ public static <T> T doInTransaction(IgniteTransactions igniteTx, TransactionConcurrency txConcurrency,
+ TransactionIsolation txIsolation, Callable<T> clo) throws Exception {
+ while (true) {
+ try (Transaction tx = igniteTx.txStart(txConcurrency, txIsolation)) {
+ T res = clo.call();
+
+ tx.commit();
+
+ return res;
+ }
+ catch (CacheException e) {
+ if (e.getCause() instanceof ClusterTopologyException) {
+ ClusterTopologyException topEx = (ClusterTopologyException)e.getCause();
+
+ topEx.retryReadyFuture().get();
+ }
+ else
+ throw e;
+ }
+ catch (ClusterTopologyException e) {
+ e.retryReadyFuture().get();
+ }
+ catch (TransactionRollbackException | TransactionOptimisticException ignore) {
+ // Safe to retry right away.
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountSerializableTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountSerializableTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountSerializableTxBenchmark.java
index 32e7653..ecb6727 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountSerializableTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountSerializableTxBenchmark.java
@@ -31,21 +31,20 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
*
*/
public class IgniteAccountSerializableTxBenchmark extends IgniteAccountTxAbstractBenchmark {
- /** */
- private static final int ACCOUNT_NUMBER = 3;
-
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
Set<Integer> accountIds = new HashSet<>();
- while (accountIds.size() < ACCOUNT_NUMBER)
+ int accNum = args.batch();
+
+ while (accountIds.size() < accNum)
accountIds.add(nextRandom(args.range()));
while (true) {
try (Transaction tx = txs.txStart(OPTIMISTIC, SERIALIZABLE)) {
Map<Integer, Account> accounts = (Map)cache.getAll(accountIds);
- if (accounts.size() != ACCOUNT_NUMBER)
+ if (accounts.size() != accNum)
throw new Exception("Failed to find accounts: " + accountIds);
Integer fromId = accountIds.iterator().next();
@@ -78,4 +77,4 @@ public class IgniteAccountSerializableTxBenchmark extends IgniteAccountTxAbstrac
return true;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountTxBenchmark.java
index 78e675e..de332c1 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAccountTxBenchmark.java
@@ -30,21 +30,20 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
*
*/
public class IgniteAccountTxBenchmark extends IgniteAccountTxAbstractBenchmark {
- /** */
- private static final int ACCOUNT_NUMBER = 3;
-
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
Set<Integer> accountIds = new TreeSet<>();
- while (accountIds.size() < ACCOUNT_NUMBER)
+ int accNum = args.batch();
+
+ while (accountIds.size() < accNum)
accountIds.add(nextRandom(args.range()));
try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
Map<Integer, Account> accounts = (Map)cache.getAll(accountIds);
- if (accounts.size() != ACCOUNT_NUMBER)
+ if (accounts.size() != accNum)
throw new Exception("Failed to find accounts: " + accountIds);
Integer fromId = accountIds.iterator().next();
@@ -71,4 +70,4 @@ public class IgniteAccountTxBenchmark extends IgniteAccountTxAbstractBenchmark {
return true;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllPutAllTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllPutAllTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllPutAllTxBenchmark.java
new file mode 100644
index 0000000..a8f6d7b
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllPutAllTxBenchmark.java
@@ -0,0 +1,73 @@
+/*
+ * 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.yardstick.cache;
+
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteTransactions;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.apache.ignite.yardstick.IgniteBenchmarkUtils.doInTransaction;
+
+/**
+ * Ignite benchmark that performs transactional putAll operations.
+ */
+public class IgniteGetAllPutAllTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Integer> {
+ /** */
+ private IgniteTransactions txs;
+
+ /** {@inheritDoc} */
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ txs = ignite().transactions();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ final ThreadRange r = threadRange();
+
+ doInTransaction(txs, args.txConcurrency(), args.txIsolation(), new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ SortedMap<Integer, Integer> vals = new TreeMap<>();
+
+ for (int i = 0; i < args.batch(); i++) {
+ int key = r.nextRandom();
+
+ vals.put(key, key);
+ }
+
+ cache.getAll(vals.keySet());
+
+ cache.putAll(vals);
+
+ return null;
+ }
+ });
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Integer> cache() {
+ return ignite().cache("tx");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
index 1a8ee14..2c4050b 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
@@ -22,17 +22,13 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
-import javax.cache.CacheException;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.MutableEntry;
-import org.apache.ignite.Ignite;
import org.apache.ignite.cache.CacheEntryProcessor;
-import org.apache.ignite.cluster.ClusterTopologyException;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionRollbackException;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+import static org.apache.ignite.yardstick.IgniteBenchmarkUtils.doInTransaction;
import static org.yardstickframework.BenchmarkUtils.println;
/**
@@ -63,7 +59,7 @@ public class IgniteTransactionalWriteInvokeBenchmark extends IgniteFailoverAbstr
final int scenario = nextRandom(2);
- return doInTransaction(ignite(), new Callable<Boolean>() {
+ return doInTransaction(ignite().transactions(), PESSIMISTIC, REPEATABLE_READ, new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
final int timeout = args.cacheOperationTimeoutMillis();
@@ -127,39 +123,6 @@ public class IgniteTransactionalWriteInvokeBenchmark extends IgniteFailoverAbstr
});
}
- /**
- * @param ignite Ignite instance.
- * @param clo Closure.
- * @return Result of closure execution.
- * @throws Exception
- */
- public static <T> T doInTransaction(Ignite ignite, Callable<T> clo) throws Exception {
- while (true) {
- try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- T res = clo.call();
-
- tx.commit();
-
- return res;
- }
- catch (CacheException e) {
- if (e.getCause() instanceof ClusterTopologyException) {
- ClusterTopologyException topEx = (ClusterTopologyException)e.getCause();
-
- topEx.retryReadyFuture().get();
- }
- else
- throw e;
- }
- catch (ClusterTopologyException e) {
- e.retryReadyFuture().get();
- }
- catch (TransactionRollbackException ignore) {
- // Safe to retry right away.
- }
- }
- }
-
/** {@inheritDoc} */
@Override protected String cacheName() {
return "tx-write-invoke";
http://git-wip-us.apache.org/repos/asf/ignite/blob/847b616f/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
index c962749..f278e8a 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
@@ -22,14 +22,10 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
-import javax.cache.CacheException;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cluster.ClusterTopologyException;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionRollbackException;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+import static org.apache.ignite.yardstick.IgniteBenchmarkUtils.doInTransaction;
import static org.yardstickframework.BenchmarkUtils.println;
/**
@@ -51,7 +47,7 @@ public class IgniteTransactionalWriteReadBenchmark extends IgniteFailoverAbstrac
for (int i = 0; i < keys.length; i++)
keys[i] = "key-" + k + "-" + i;
- return doInTransaction(ignite(), new Callable<Boolean>() {
+ return doInTransaction(ignite().transactions(), PESSIMISTIC, REPEATABLE_READ, new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
Map<String, Long> map = new HashMap<>();
@@ -101,39 +97,6 @@ public class IgniteTransactionalWriteReadBenchmark extends IgniteFailoverAbstrac
});
}
- /**
- * @param ignite Ignite instance.
- * @param clo Closure.
- * @return Result of closure execution.
- * @throws Exception
- */
- public static <T> T doInTransaction(Ignite ignite, Callable<T> clo) throws Exception {
- while (true) {
- try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- T res = clo.call();
-
- tx.commit();
-
- return res;
- }
- catch (CacheException e) {
- if (e.getCause() instanceof ClusterTopologyException) {
- ClusterTopologyException topEx = (ClusterTopologyException)e.getCause();
-
- topEx.retryReadyFuture().get();
- }
- else
- throw e;
- }
- catch (ClusterTopologyException e) {
- e.retryReadyFuture().get();
- }
- catch (TransactionRollbackException ignore) {
- // Safe to retry right away.
- }
- }
- }
-
/** {@inheritDoc} */
@Override protected String cacheName() {
return "tx-write-read";
[36/50] [abbrv] ignite git commit: IGNITE-1921 .Net: Fixed handle
leak during ComputeJobHolder serialization.
Posted by vo...@apache.org.
IGNITE-1921 .Net: Fixed handle leak during ComputeJobHolder serialization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fff85cb2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fff85cb2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fff85cb2
Branch: refs/heads/ignite-1816
Commit: fff85cb22bdffb0f758977156d41e683210ed148
Parents: b96886d
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Tue Nov 17 16:46:22 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 17 16:46:22 2015 +0300
----------------------------------------------------------------------
.../Compute/ComputeApiTest.cs | 22 +++++-
.../Impl/Compute/ComputeImpl.cs | 12 ++-
.../Impl/Compute/ComputeTaskHolder.cs | 79 +++++++++++++-------
3 files changed, 84 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fff85cb2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index f02e67e..cb582b7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -1087,6 +1087,16 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(_grid1.GetCompute().ClusterGroup.GetNodes().Count, res);
}
+ [Test]
+ public void TestExceptions()
+ {
+ Assert.Throws<BinaryObjectException>(() => _grid1.GetCompute().Broadcast(new InvalidComputeAction()));
+
+ Assert.Throws<BinaryObjectException>(
+ () => _grid1.GetCompute().Execute<NetSimpleJobArgument, NetSimpleJobResult, NetSimpleTaskResult>(
+ typeof (NetSimpleTask), new NetSimpleJobArgument(-1)));
+ }
+
/// <summary>
/// Create configuration.
/// </summary>
@@ -1143,7 +1153,7 @@ namespace Apache.Ignite.Core.Tests.Compute
for (int i = 0; i < subgrid.Count; i++)
{
- NetSimpleJob job = new NetSimpleJob {Arg = arg};
+ var job = arg.Arg > 0 ? new NetSimpleJob {Arg = arg} : new InvalidNetSimpleJob();
jobs[job] = subgrid[i];
}
@@ -1183,6 +1193,11 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
+ class InvalidNetSimpleJob : NetSimpleJob
+ {
+ // No-op.
+ }
+
[Serializable]
class NetSimpleJobArgument
{
@@ -1234,6 +1249,11 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
+ class InvalidComputeAction : ComputeAction
+ {
+ // No-op.
+ }
+
interface IUserInterface<out T>
{
T Invoke();
http://git-wip-us.apache.org/repos/asf/ignite/blob/fff85cb2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
index bbb9489..b44b2ee 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
@@ -583,7 +583,17 @@ namespace Apache.Ignite.Core.Impl.Compute
var jobHandle = Marshaller.Ignite.HandleRegistry.Allocate(jobHolder);
writer.WriteLong(jobHandle);
- writer.WriteObject(jobHolder);
+
+ try
+ {
+ writer.WriteObject(jobHolder);
+ }
+ catch (Exception)
+ {
+ Marshaller.Ignite.HandleRegistry.Release(jobHandle);
+
+ throw;
+ }
return jobHandle;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fff85cb2/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
index 8f9d06a..e992245 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
@@ -221,34 +221,8 @@ namespace Apache.Ignite.Core.Impl.Compute
else
{
writer.WriteBoolean(true); // Map produced result.
- writer.WriteInt(map.Count); // Amount of mapped jobs.
- var jobHandles = new List<long>(map.Count);
-
- foreach (KeyValuePair<IComputeJob<T>, IClusterNode> mapEntry in map)
- {
- var job = new ComputeJobHolder(_compute.ClusterGroup.Ignite as Ignite, mapEntry.Key.ToNonGeneric());
-
- IClusterNode node = mapEntry.Value;
-
- var jobHandle = ignite.HandleRegistry.Allocate(job);
-
- jobHandles.Add(jobHandle);
-
- writer.WriteLong(jobHandle);
-
- if (node.IsLocal)
- writer.WriteBoolean(false); // Job is not serialized.
- else
- {
- writer.WriteBoolean(true); // Job is serialized.
- writer.WriteObject(job);
- }
-
- writer.WriteGuid(node.Id);
- }
-
- _jobHandles = jobHandles;
+ _jobHandles = WriteJobs(writer, map);
}
}
else
@@ -277,6 +251,57 @@ namespace Apache.Ignite.Core.Impl.Compute
}
}
+ /// <summary>
+ /// Writes job map.
+ /// </summary>
+ /// <param name="writer">Writer.</param>
+ /// <param name="map">Map</param>
+ /// <returns>Job handle list.</returns>
+ private static List<long> WriteJobs(BinaryWriter writer, IDictionary<IComputeJob<T>, IClusterNode> map)
+ {
+ Debug.Assert(writer != null && map != null);
+
+ writer.WriteInt(map.Count); // Amount of mapped jobs.
+
+ var jobHandles = new List<long>(map.Count);
+ var ignite = writer.Marshaller.Ignite;
+
+ try
+ {
+ foreach (KeyValuePair<IComputeJob<T>, IClusterNode> mapEntry in map)
+ {
+ var job = new ComputeJobHolder(ignite, mapEntry.Key.ToNonGeneric());
+
+ IClusterNode node = mapEntry.Value;
+
+ var jobHandle = ignite.HandleRegistry.Allocate(job);
+
+ jobHandles.Add(jobHandle);
+
+ writer.WriteLong(jobHandle);
+
+ if (node.IsLocal)
+ writer.WriteBoolean(false); // Job is not serialized.
+ else
+ {
+ writer.WriteBoolean(true); // Job is serialized.
+ writer.WriteObject(job);
+ }
+
+ writer.WriteGuid(node.Id);
+ }
+ }
+ catch (Exception)
+ {
+ foreach (var handle in jobHandles)
+ ignite.HandleRegistry.Release(handle);
+
+ throw;
+ }
+
+ return jobHandles;
+ }
+
/** <inheritDoc /> */
public int JobResultLocal(ComputeJobHolder job)
{
[45/50] [abbrv] ignite git commit: IGNITE-1934 .Net: Store tests
broken after keepPortableInStore renaming.
Posted by vo...@apache.org.
IGNITE-1934 .Net: Store tests broken after keepPortableInStore renaming.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f3b0be79
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f3b0be79
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f3b0be79
Branch: refs/heads/ignite-1816
Commit: f3b0be79e3dc12a1cab54525e905574cc7f2b7c7
Parents: d69362f
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Nov 18 10:03:05 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 18 10:03:05 2015 +0300
----------------------------------------------------------------------
.../Config/native-client-test-cache-parallel-store.xml | 2 +-
.../Config/native-client-test-cache-store.xml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f3b0be79/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
index 74abbf8..af03e69 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
@@ -39,7 +39,7 @@
<property name="name" value="object_store_parallel"/>
<property name="cacheMode" value="LOCAL"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="keepPortableInStore" value="false"/>
+ <property name="keepBinaryInStore" value="false"/>
<property name="cacheStoreFactory">
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
http://git-wip-us.apache.org/repos/asf/ignite/blob/f3b0be79/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
index c2bf78c..b414a91 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
@@ -55,7 +55,7 @@
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeThrough" value="true"/>
<property name="readThrough" value="true"/>
- <property name="keepPortableInStore" value="false"/>
+ <property name="keepBinaryInStore" value="false"/>
<property name="cacheStoreFactory">
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
@@ -70,7 +70,7 @@
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeThrough" value="true"/>
<property name="readThrough" value="true"/>
- <property name="keepPortableInStore" value="false"/>
+ <property name="keepBinaryInStore" value="false"/>
<property name="cacheStoreFactory">
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
[04/50] [abbrv] ignite git commit: ignite-1863: Allowing to use null
in IgniteAtomicReference.compareAndSet operation
Posted by vo...@apache.org.
ignite-1863: Allowing to use null in IgniteAtomicReference.compareAndSet operation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e02b68c9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e02b68c9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e02b68c9
Branch: refs/heads/ignite-1816
Commit: e02b68c93c0b4a2905693d79e4d1583862206ad6
Parents: 3de9d47
Author: Artem Shutak <as...@gridgain.com>
Authored: Tue Nov 10 13:13:31 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Nov 10 13:13:31 2015 +0300
----------------------------------------------------------------------
.../GridCacheAtomicReferenceImpl.java | 2 +-
...CacheAtomicReferenceApiSelfAbstractTest.java | 20 +++++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e02b68c9/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 b25e111..c0c38b2 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
@@ -204,7 +204,7 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef
private IgnitePredicate<T> wrapperPredicate(final T val) {
return new IgnitePredicate<T>() {
@Override public boolean apply(T e) {
- return val != null && val.equals(e);
+ return F.eq(val, e);
}
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e02b68c9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
index c12da82..278bcf9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
@@ -109,4 +109,22 @@ public abstract class GridCacheAtomicReferenceApiSelfAbstractTest extends Ignite
assertEquals(null, atomic.get());
}
-}
\ No newline at end of file
+
+ /**
+ * JUnit.
+ *
+ * @throws Exception If failed.
+ */
+ public void testCompareAndSetNullValue() throws Exception {
+ String atomicName = UUID.randomUUID().toString();
+
+ IgniteAtomicReference<String> atomic = grid(0).atomicReference(atomicName, null, true);
+
+ assertEquals(null, atomic.get());
+
+ boolean success = atomic.compareAndSet(null, "newVal");
+
+ assertTrue(success);
+ assertEquals("newVal", atomic.get());
+ }
+}
[08/50] [abbrv] ignite git commit: Merge branch 'ignite-1.5' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5
Posted by vo...@apache.org.
Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/37cafb6e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/37cafb6e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/37cafb6e
Branch: refs/heads/ignite-1816
Commit: 37cafb6ef750e8dd094803cc02f1cc4d36e9dc87
Parents: d70f7ed 9396ccb
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Nov 10 14:21:07 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Nov 10 14:21:07 2015 +0300
----------------------------------------------------------------------
.../yardstick/config/ignite-store-config.xml | 31 +++++++++++---------
1 file changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
[44/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
IGNITE-1881: Internal portable -> binary renamings.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d69362f8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d69362f8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d69362f8
Branch: refs/heads/ignite-1816
Commit: d69362f86b3da5b29f42366938ba1c82403dcb2a
Parents: fff85cb
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Tue Nov 17 16:58:53 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 17 16:58:53 2015 +0300
----------------------------------------------------------------------
.../dotnet/PlatformDotNetConfiguration.java | 2 +-
...CacheAtomicReferenceApiSelfAbstractTest.java | 10 +-
.../platform/PlatformComputeBinarizable.java | 42 +
.../PlatformComputeBinarizableArgTask.java | 119 +
.../platform/PlatformComputeEchoTask.java | 12 +-
.../PlatformComputeJavaBinarizable.java | 39 +
.../platform/PlatformComputeJavaPortable.java | 39 -
.../platform/PlatformComputePortable.java | 42 -
.../PlatformComputePortableArgTask.java | 119 -
.../Apache.Ignite.Benchmarks.csproj | 4 +-
.../Apache.Ignite.Benchmarks/BenchmarkRunner.cs | 4 +-
.../Binary/BinarizableReadBenchmark.cs | 125 +
.../Binary/BinarizableWriteBenchmark.cs | 135 ++
.../Interop/PlatformBenchmarkBase.cs | 8 +-
.../Portable/PortableReadBenchmark.cs | 126 -
.../Portable/PortableWriteBenchmark.cs | 135 --
.../Apache.Ignite.Core.Tests.csproj | 27 +-
.../Apache.Ignite.Core.Tests.nunit | 7 +
.../Binary/BinaryBuilderSelfTest.cs | 1721 ++++++++++++++
.../Binary/BinarySelfTest.cs | 2157 ++++++++++++++++++
.../Binary/BinaryStructureTest.cs | 250 ++
.../BinaryConfigurationTest.cs | 173 ++
.../Cache/CacheAbstractTest.cs | 94 +-
.../Cache/CacheAffinityTest.cs | 4 +-
.../Cache/CacheDynamicStartTest.cs | 6 +-
.../Cache/Query/CacheQueriesTest.cs | 80 +-
.../Continuous/ContinuousQueryAbstractTest.cs | 210 +-
.../ContinuousQueryNoBackupAbstractTest.cs | 4 +-
.../Cache/Store/CacheStoreTest.cs | 68 +-
.../Compute/AbstractTaskTest.cs | 8 +-
.../Compute/BinarizableClosureTaskTest.cs | 185 ++
.../Compute/BinarizableTaskTest.cs | 269 +++
.../Compute/ComputeApiTest.cs | 62 +-
.../Compute/FailoverTaskSelfTest.cs | 18 +-
.../Forked/ForkedBinarizableClosureTaskTest.cs | 30 +
.../Forked/ForkedPortableClosureTaskTest.cs | 30 -
.../Compute/Forked/ForkedResourceTaskTest.cs | 3 -
.../Forked/ForkedSerializableClosureTaskTest.cs | 3 -
.../Compute/PortableClosureTaskTest.cs | 217 --
.../Compute/PortableTaskTest.cs | 269 ---
.../Compute/TaskAdapterTest.cs | 14 +-
.../Compute/TaskResultTest.cs | 46 +-
.../Config/Compute/compute-grid1.xml | 6 +-
.../Config/Compute/compute-standalone.xml | 14 +-
.../Apache.Ignite.Core.Tests/Config/binary.xml | 56 +
.../Config/cache-binarizables.xml | 78 +
.../Config/cache-portables.xml | 78 -
.../Config/cache-query-continuous.xml | 8 +-
.../Config/marshaller-explicit.xml | 47 +
.../Config/marshaller-portable.xml | 43 -
.../Config/native-client-test-cache-store.xml | 2 +-
.../Config/native-client-test-cache.xml | 51 -
.../Config/portable.xml | 56 -
.../Dataload/DataStreamerTest.cs | 42 +-
.../Apache.Ignite.Core.Tests/EventsTest.cs | 16 +-
.../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 28 +-
.../Apache.Ignite.Core.Tests/FutureTest.cs | 10 +-
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 10 +-
.../Portable/PortableApiSelfTest.cs | 1777 ---------------
.../Portable/PortableSelfTest.cs | 2157 ------------------
.../Portable/PortableStructureTest.cs | 250 --
.../PortableConfigurationTest.cs | 173 --
.../Query/BinarizablePerson.cs | 69 +
.../Query/ImplicitBinarizablePerson.cs | 46 +
.../Query/ImplicitPortablePerson.cs | 46 -
.../Query/NoDefBinarizablePerson.cs | 35 +
.../Query/NoDefPortablePerson.cs | 35 -
.../Query/PortablePerson.cs | 69 -
.../Services/ServiceProxyTest.cs | 130 +-
.../Services/ServicesTest.cs | 88 +-
.../TypeResolverTest.cs | 20 +-
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 20 +-
.../examples/Config/example-cache-query.xml | 12 +-
.../dotnet/examples/Config/example-cache.xml | 12 +-
parent/pom.xml | 1 +
75 files changed, 6133 insertions(+), 6268 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
index ff5656b..f323085 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Mirror of .Net class Configuration.cs
+ * Mirror of .Net class IgniteConfiguration.cs
*/
public class PlatformDotNetConfiguration implements PlatformConfiguration {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
index 416776a..278bcf9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
@@ -97,15 +97,13 @@ public abstract class GridCacheAtomicReferenceApiSelfAbstractTest extends Ignite
String initVal = "qwerty";
- IgniteAtomicReference<String> atomic = grid(0).atomicReference(atomicName, null, true);
+ IgniteAtomicReference<String> atomic = grid(0).atomicReference(atomicName, initVal, true);
- assertEquals(null, atomic.get());
+ assertEquals(initVal, atomic.get());
- boolean res = atomic.compareAndSet(null, "x");
+ atomic.compareAndSet("h", "j");
- assertEquals(null, atomic.get()); // ok
- assertTrue(res); // fail
- assertEquals("x", atomic.get()); // fail
+ assertEquals(initVal, atomic.get());
atomic.compareAndSet(initVal, null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizable.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizable.java
new file mode 100644
index 0000000..55b3099
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizable.java
@@ -0,0 +1,42 @@
+/*
+ * 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.platform;
+
+/**
+ * Binarizable object for task tests.
+ */
+public class PlatformComputeBinarizable {
+ /** Field. */
+ public int field;
+
+ /**
+ * Constructor.
+ */
+ public PlatformComputeBinarizable() {
+ // No-op.
+ }
+
+ /**
+ * Constructor,
+ *
+ * @param field Field.
+ */
+ public PlatformComputeBinarizable(int field) {
+ this.field = field;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
new file mode 100644
index 0000000..77c7e3a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeBinarizableArgTask.java
@@ -0,0 +1,119 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+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.util.typedef.F;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Task working with binarizable argument.
+ */
+public class PlatformComputeBinarizableArgTask extends ComputeTaskAdapter<Object, Integer> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) {
+ return Collections.singletonMap(new BinarizableArgJob(arg), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ @Nullable @Override public Integer reduce(List<ComputeJobResult> results) {
+ ComputeJobResult res = results.get(0);
+
+ if (res.getException() != null)
+ throw res.getException();
+ else
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class BinarizableArgJob extends ComputeJobAdapter implements Externalizable {
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** Argument. */
+ private Object arg;
+
+ /**
+ * Constructor.
+ */
+ public BinarizableArgJob() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg Argument.
+ */
+ private BinarizableArgJob(Object arg) {
+ this.arg = arg;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ BinaryObject arg0 = ((BinaryObject)arg);
+
+ BinaryType meta = ignite.binary().metadata(arg0.typeId());
+
+ if (meta == null)
+ throw new IgniteException("Metadata doesn't exist.");
+
+ if (meta.fields() == null || !meta.fields().contains("Field"))
+ throw new IgniteException("Field metadata doesn't exist.");
+
+ if (!F.eq("int", meta.fieldTypeName("Field")))
+ throw new IgniteException("Invalid field type: " + meta.fieldTypeName("Field"));
+
+ if (meta.affinityKeyFieldName() != null)
+ throw new IgniteException("Unexpected affinity key: " + meta.affinityKeyFieldName());
+
+ return arg0.field("field");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(arg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ arg = in.readObject();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
index f64ca7d..fe4e01c 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -155,19 +155,19 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
return Collections.singletonMap(1, 1);
case TYPE_PORTABLE:
- return new PlatformComputePortable(1);
+ return new PlatformComputeBinarizable(1);
case TYPE_PORTABLE_JAVA:
- return new PlatformComputeJavaPortable(1);
+ return new PlatformComputeJavaBinarizable(1);
case TYPE_OBJ_ARRAY:
return new String[] { "foo", "bar", "baz" };
case TYPE_PORTABLE_ARRAY:
- return new PlatformComputePortable[] {
- new PlatformComputePortable(1),
- new PlatformComputePortable(2),
- new PlatformComputePortable(3)
+ return new PlatformComputeBinarizable[] {
+ new PlatformComputeBinarizable(1),
+ new PlatformComputeBinarizable(2),
+ new PlatformComputeBinarizable(3)
};
case TYPE_ENUM:
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaBinarizable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaBinarizable.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaBinarizable.java
new file mode 100644
index 0000000..ade09db
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaBinarizable.java
@@ -0,0 +1,39 @@
+/*
+ * 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.platform;
+
+/**
+ * Binarizable object defined only in Java.
+ */
+public class PlatformComputeJavaBinarizable extends PlatformComputeBinarizable {
+ /**
+ * Constructor.
+ */
+ public PlatformComputeJavaBinarizable() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param field Field.
+ */
+ public PlatformComputeJavaBinarizable(int field) {
+ super(field);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java
deleted file mode 100644
index 7a940c4..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java
+++ /dev/null
@@ -1,39 +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.platform;
-
-/**
- * Portable object defined only in Java.
- */
-public class PlatformComputeJavaPortable extends PlatformComputePortable {
- /**
- * Constructor.
- */
- public PlatformComputeJavaPortable() {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param field Field.
- */
- public PlatformComputeJavaPortable(int field) {
- super(field);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java
deleted file mode 100644
index f31f093..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortable.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.platform;
-
-/**
- * Portable object for task tests.
- */
-public class PlatformComputePortable {
- /** Field. */
- public int field;
-
- /**
- * Constructor.
- */
- public PlatformComputePortable() {
- // No-op.
- }
-
- /**
- * Constructor,
- *
- * @param field Field.
- */
- public PlatformComputePortable(int field) {
- this.field = field;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
deleted file mode 100644
index 1e3c499..0000000
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
+++ /dev/null
@@ -1,119 +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.platform;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cluster.ClusterNode;
-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.util.typedef.F;
-import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Task working with portable argument.
- */
-public class PlatformComputePortableArgTask extends ComputeTaskAdapter<Object, Integer> {
- /** {@inheritDoc} */
- @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) {
- return Collections.singletonMap(new PortableArgJob(arg), F.first(subgrid));
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
- @Nullable @Override public Integer reduce(List<ComputeJobResult> results) {
- ComputeJobResult res = results.get(0);
-
- if (res.getException() != null)
- throw res.getException();
- else
- return results.get(0).getData();
- }
-
- /**
- * Job.
- */
- private static class PortableArgJob extends ComputeJobAdapter implements Externalizable {
- /** */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** Argument. */
- private Object arg;
-
- /**
- * Constructor.
- */
- public PortableArgJob() {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param arg Argument.
- */
- private PortableArgJob(Object arg) {
- this.arg = arg;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object execute() {
- BinaryObject arg0 = ((BinaryObject)arg);
-
- BinaryType meta = ignite.binary().metadata(arg0.typeId());
-
- if (meta == null)
- throw new IgniteException("Metadata doesn't exist.");
-
- if (meta.fields() == null || !meta.fields().contains("Field"))
- throw new IgniteException("Field metadata doesn't exist.");
-
- if (!F.eq("int", meta.fieldTypeName("Field")))
- throw new IgniteException("Invalid field type: " + meta.fieldTypeName("Field"));
-
- if (meta.affinityKeyFieldName() != null)
- throw new IgniteException("Unexpected affinity key: " + meta.affinityKeyFieldName());
-
- return arg0.field("field");
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(arg);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- arg = in.readObject();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
index 99737b8..14b6466 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
@@ -63,8 +63,8 @@
<Compile Include="Model\Employee.cs" />
<Compile Include="Model\Sex.cs" />
<Compile Include="Model\TestModel.cs" />
- <Compile Include="Portable\PortableReadBenchmark.cs" />
- <Compile Include="Portable\PortableWriteBenchmark.cs" />
+ <Compile Include="Binary\BinarizableReadBenchmark.cs" />
+ <Compile Include="Binary\BinarizableWriteBenchmark.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Result\BenchmarkConsoleResultWriter.cs" />
<Compile Include="Result\BenchmarkFileResultWriter.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
index 2d0d348..5d8e78a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Benchmarks
using System;
using System.Diagnostics;
using System.Text;
- using Apache.Ignite.Benchmarks.Portable;
+ using Apache.Ignite.Benchmarks.Binary;
/// <summary>
/// Benchmark runner.
@@ -35,7 +35,7 @@ namespace Apache.Ignite.Benchmarks
public static void Main(string[] args)
{
args = new[] {
- typeof(PortableReadBenchmark).FullName,
+ typeof(BinarizableReadBenchmark).FullName,
"-ConfigPath", @"modules\platforms\dotnet\Apache.Ignite.Benchmarks\Config\benchmark.xml",
"-Threads", "1",
"-Warmup", "0",
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableReadBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableReadBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableReadBenchmark.cs
new file mode 100644
index 0000000..09e588e
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableReadBenchmark.cs
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Benchmarks.Binary
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Benchmarks.Model;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Memory;
+
+ /// <summary>
+ /// Binary read benchmark.
+ /// </summary>
+ internal class BinarizableReadBenchmark : BenchmarkBase
+ {
+ /** Marshaller. */
+ private readonly Marshaller _marsh;
+
+ /** Memory manager. */
+ private readonly PlatformMemoryManager _memMgr = new PlatformMemoryManager(1024);
+
+ /** Memory chunk. */
+ private readonly IPlatformMemory _mem;
+
+ /** Pre-allocated address. */
+ private readonly Address _address = BenchmarkUtils.GetRandomAddress();
+
+ /** Pre-allocated model. */
+ private readonly TestModel _model = new TestModel
+ {
+ Byte = 5,
+ Boolean = true,
+ BooleanArray = new[] {true, false, false, false, true, true},
+ ByteArray = new byte[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
+ Char = 'h',
+ CharArray = new[] {'b', 'n', 'm', 'q', 'w', 'e', 'r', 't', 'y'},
+ Date = DateTime.Now,
+ DateArray = Enumerable.Range(1, 15).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray(),
+ Decimal = decimal.MinValue,
+ DecimalArray = new decimal?[] {1.1M, decimal.MinValue, decimal.MaxValue, decimal.MinusOne, decimal.One},
+ Double = double.MaxValue/2,
+ DoubleArray = new[] {double.MaxValue, double.MinValue, double.Epsilon, double.NegativeInfinity},
+ Float = 98,
+ FloatArray = new[] {float.MinValue, float.MaxValue, 10F, 36F},
+ Guid = Guid.NewGuid(),
+ GuidArray = Enumerable.Range(1, 9).Select(x => (Guid?) Guid.NewGuid()).ToArray(),
+ Int = -90,
+ IntArray = new[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
+ Long = long.MinValue,
+ LongArray = Enumerable.Range(1, 12).Select(x => (long) x).ToArray(),
+ Short = 67,
+ ShortArray = Enumerable.Range(100, 12).Select(x => (short) x).ToArray(),
+ String = "String value test 123",
+ StringArray = Enumerable.Range(1, 13).Select(x => Guid.NewGuid().ToString()).ToArray()
+ };
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinarizableReadBenchmark"/> class.
+ /// </summary>
+ public BinarizableReadBenchmark()
+ {
+ _marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (Address)),
+ new BinaryTypeConfiguration(typeof (TestModel))
+ }
+ });
+
+ _mem = _memMgr.Allocate();
+
+ var stream = _mem.GetStream();
+
+ //_marsh.StartMarshal(stream).Write(_model);
+ _marsh.StartMarshal(stream).Write(_address);
+
+ stream.SynchronizeOutput();
+ }
+
+ /// <summary>
+ /// Populate descriptors.
+ /// </summary>
+ /// <param name="descs">Descriptors.</param>
+ protected override void GetDescriptors(ICollection<BenchmarkOperationDescriptor> descs)
+ {
+ descs.Add(BenchmarkOperationDescriptor.Create("ReadTestModel", ReadTestModel, 1));
+ }
+
+ /// <summary>
+ /// Write address.
+ /// </summary>
+ /// <param name="state">State.</param>
+ private void ReadTestModel(BenchmarkState state)
+ {
+ //var model = _marsh.StartUnmarshal(_mem.GetStream()).ReadObject<TestModel>();
+
+ //if (model.Byte != _model.Byte)
+ // throw new InvalidOperationException();
+
+ var model = _marsh.StartUnmarshal(_mem.GetStream()).ReadObject<Address>();
+
+ if (model.FlatNumber != _address.FlatNumber)
+ throw new InvalidOperationException();
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableWriteBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableWriteBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableWriteBenchmark.cs
new file mode 100644
index 0000000..c4d375f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Binary/BinarizableWriteBenchmark.cs
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Benchmarks.Binary
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Benchmarks.Model;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Memory;
+
+ /// <summary>
+ /// Binary write benchmark.
+ /// </summary>
+ internal class BinarizableWriteBenchmark : BenchmarkBase
+ {
+ /** Marshaller. */
+ private readonly Marshaller _marsh;
+
+ /** Memory manager. */
+ private readonly PlatformMemoryManager _memMgr = new PlatformMemoryManager(1024);
+
+ /** Pre-allocated address. */
+ private readonly Address _address = BenchmarkUtils.GetRandomAddress();
+
+ /** Pre-allocated model. */
+ private readonly TestModel _model = new TestModel
+ {
+ Byte = 5,
+ Boolean = true,
+ BooleanArray = new[] {true, false, false, false, true, true},
+ ByteArray = new byte[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
+ Char = 'h',
+ CharArray = new[] {'b', 'n', 'm', 'q', 'w', 'e', 'r', 't', 'y'},
+ Date = DateTime.Now,
+ DateArray = Enumerable.Range(1, 15).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray(),
+ Decimal = decimal.MinValue,
+ DecimalArray = new decimal?[] {1.1M, decimal.MinValue, decimal.MaxValue, decimal.MinusOne, decimal.One},
+ Double = double.MaxValue/2,
+ DoubleArray = new[] {double.MaxValue, double.MinValue, double.Epsilon, double.NegativeInfinity},
+ Float = 98,
+ FloatArray = new[] {float.MinValue, float.MaxValue, 10F, 36F},
+ Guid = Guid.NewGuid(),
+ GuidArray = Enumerable.Range(1, 9).Select(x => (Guid?) Guid.NewGuid()).ToArray(),
+ Int = -90,
+ IntArray = new[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
+ Long = long.MinValue,
+ LongArray = Enumerable.Range(1, 12).Select(x => (long) x).ToArray(),
+ Short = 67,
+ ShortArray = Enumerable.Range(100, 12).Select(x => (short) x).ToArray(),
+ String = "String value test 123",
+ StringArray = Enumerable.Range(1, 13).Select(x => Guid.NewGuid().ToString()).ToArray()
+ };
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinarizableWriteBenchmark"/> class.
+ /// </summary>
+ public BinarizableWriteBenchmark()
+ {
+ _marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (Address))
+ //new BinaryTypeConfiguration(typeof (TestModel))
+ }
+ });
+ }
+
+ /// <summary>
+ /// Populate descriptors.
+ /// </summary>
+ /// <param name="descs">Descriptors.</param>
+ protected override void GetDescriptors(ICollection<BenchmarkOperationDescriptor> descs)
+ {
+ descs.Add(BenchmarkOperationDescriptor.Create("WriteAddress", WriteAddress, 1));
+ //descs.Add(BenchmarkOperationDescriptor.Create("WriteTestModel", WriteTestModel, 1));
+ }
+
+ /// <summary>
+ /// Write address.
+ /// </summary>
+ /// <param name="state">State.</param>
+ private void WriteAddress(BenchmarkState state)
+ {
+ var mem = _memMgr.Allocate();
+
+ try
+ {
+ var stream = mem.GetStream();
+
+ _marsh.StartMarshal(stream).Write(_address);
+ }
+ finally
+ {
+ mem.Release();
+ }
+ }
+ /// <summary>
+ /// Write address.
+ /// </summary>
+ /// <param name="state">State.</param>
+ private void WriteTestModel(BenchmarkState state)
+ {
+ var mem = _memMgr.Allocate();
+
+ try
+ {
+ var stream = mem.GetStream();
+
+ _marsh.StartMarshal(stream).Write(_model);
+ }
+ finally
+ {
+ mem.Release();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs
index 67809d5..eeebed0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs
@@ -58,7 +58,7 @@ namespace Apache.Ignite.Benchmarks.Interop
var cfg = new IgniteConfiguration
{
- BinaryConfiguration = GetPortableConfiguration(),
+ BinaryConfiguration = GetBinaryConfiguration(),
JvmOptions = new List<string>
{
"-Xms2g",
@@ -75,10 +75,10 @@ namespace Apache.Ignite.Benchmarks.Interop
}
/// <summary>
- /// Get portable configuration.
+ /// Get binary configuration.
/// </summary>
- /// <returns>Portable configuration.</returns>
- private static BinaryConfiguration GetPortableConfiguration()
+ /// <returns>Gets binary configuration.</returns>
+ private static BinaryConfiguration GetBinaryConfiguration()
{
return new BinaryConfiguration
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableReadBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableReadBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableReadBenchmark.cs
deleted file mode 100644
index ad9ae39..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableReadBenchmark.cs
+++ /dev/null
@@ -1,126 +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.
- */
-
-namespace Apache.Ignite.Benchmarks.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Benchmarks.Model;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Impl.Binary;
- using Apache.Ignite.Core.Impl.Memory;
-
- /// <summary>
- /// Portable read benchmark.
- /// </summary>
- internal class PortableReadBenchmark : BenchmarkBase
- {
- /** Marshaller. */
- private readonly Marshaller _marsh;
-
- /** Memory manager. */
- private readonly PlatformMemoryManager _memMgr = new PlatformMemoryManager(1024);
-
- /** Memory chunk. */
- private readonly IPlatformMemory _mem;
-
- /** Pre-allocated address. */
- private readonly Address _address = BenchmarkUtils.GetRandomAddress();
-
-
- /** Pre-allocated model. */
- private readonly TestModel _model = new TestModel
- {
- Byte = 5,
- Boolean = true,
- BooleanArray = new[] {true, false, false, false, true, true},
- ByteArray = new byte[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
- Char = 'h',
- CharArray = new[] {'b', 'n', 'm', 'q', 'w', 'e', 'r', 't', 'y'},
- Date = DateTime.Now,
- DateArray = Enumerable.Range(1, 15).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray(),
- Decimal = decimal.MinValue,
- DecimalArray = new decimal?[] {1.1M, decimal.MinValue, decimal.MaxValue, decimal.MinusOne, decimal.One},
- Double = double.MaxValue/2,
- DoubleArray = new[] {double.MaxValue, double.MinValue, double.Epsilon, double.NegativeInfinity},
- Float = 98,
- FloatArray = new[] {float.MinValue, float.MaxValue, 10F, 36F},
- Guid = Guid.NewGuid(),
- GuidArray = Enumerable.Range(1, 9).Select(x => (Guid?) Guid.NewGuid()).ToArray(),
- Int = -90,
- IntArray = new[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
- Long = long.MinValue,
- LongArray = Enumerable.Range(1, 12).Select(x => (long) x).ToArray(),
- Short = 67,
- ShortArray = Enumerable.Range(100, 12).Select(x => (short) x).ToArray(),
- String = "String value test 123",
- StringArray = Enumerable.Range(1, 13).Select(x => Guid.NewGuid().ToString()).ToArray()
- };
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableReadBenchmark"/> class.
- /// </summary>
- public PortableReadBenchmark()
- {
- _marsh = new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (Address)),
- new BinaryTypeConfiguration(typeof (TestModel))
- }
- });
-
- _mem = _memMgr.Allocate();
-
- var stream = _mem.GetStream();
-
- //_marsh.StartMarshal(stream).Write(_model);
- _marsh.StartMarshal(stream).Write(_address);
-
- stream.SynchronizeOutput();
- }
-
- /// <summary>
- /// Populate descriptors.
- /// </summary>
- /// <param name="descs">Descriptors.</param>
- protected override void GetDescriptors(ICollection<BenchmarkOperationDescriptor> descs)
- {
- descs.Add(BenchmarkOperationDescriptor.Create("ReadTestModel", ReadTestModel, 1));
- }
-
- /// <summary>
- /// Write address.
- /// </summary>
- /// <param name="state">State.</param>
- private void ReadTestModel(BenchmarkState state)
- {
- //var model = _marsh.StartUnmarshal(_mem.GetStream()).ReadObject<TestModel>();
-
- //if (model.Byte != _model.Byte)
- // throw new InvalidOperationException();
-
- var model = _marsh.StartUnmarshal(_mem.GetStream()).ReadObject<Address>();
-
- if (model.FlatNumber != _address.FlatNumber)
- throw new InvalidOperationException();
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
deleted file mode 100644
index a630161..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
+++ /dev/null
@@ -1,135 +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.
- */
-
-namespace Apache.Ignite.Benchmarks.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Benchmarks.Model;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Impl.Binary;
- using Apache.Ignite.Core.Impl.Memory;
-
- /// <summary>
- /// Portable write benchmark.
- /// </summary>
- internal class PortableWriteBenchmark : BenchmarkBase
- {
- /** Marshaller. */
- private readonly Marshaller _marsh;
-
- /** Memory manager. */
- private readonly PlatformMemoryManager _memMgr = new PlatformMemoryManager(1024);
-
- /** Pre-allocated address. */
- private readonly Address _address = BenchmarkUtils.GetRandomAddress();
-
- /** Pre-allocated model. */
- private readonly TestModel _model = new TestModel
- {
- Byte = 5,
- Boolean = true,
- BooleanArray = new[] {true, false, false, false, true, true},
- ByteArray = new byte[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
- Char = 'h',
- CharArray = new[] {'b', 'n', 'm', 'q', 'w', 'e', 'r', 't', 'y'},
- Date = DateTime.Now,
- DateArray = Enumerable.Range(1, 15).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray(),
- Decimal = decimal.MinValue,
- DecimalArray = new decimal?[] {1.1M, decimal.MinValue, decimal.MaxValue, decimal.MinusOne, decimal.One},
- Double = double.MaxValue/2,
- DoubleArray = new[] {double.MaxValue, double.MinValue, double.Epsilon, double.NegativeInfinity},
- Float = 98,
- FloatArray = new[] {float.MinValue, float.MaxValue, 10F, 36F},
- Guid = Guid.NewGuid(),
- GuidArray = Enumerable.Range(1, 9).Select(x => (Guid?) Guid.NewGuid()).ToArray(),
- Int = -90,
- IntArray = new[] {128, 1, 2, 3, 5, 6, 8, 9, 14},
- Long = long.MinValue,
- LongArray = Enumerable.Range(1, 12).Select(x => (long) x).ToArray(),
- Short = 67,
- ShortArray = Enumerable.Range(100, 12).Select(x => (short) x).ToArray(),
- String = "String value test 123",
- StringArray = Enumerable.Range(1, 13).Select(x => Guid.NewGuid().ToString()).ToArray()
- };
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableWriteBenchmark"/> class.
- /// </summary>
- public PortableWriteBenchmark()
- {
- _marsh = new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (Address))
- //new PortableTypeConfiguration(typeof (TestModel))
- }
- });
- }
-
- /// <summary>
- /// Populate descriptors.
- /// </summary>
- /// <param name="descs">Descriptors.</param>
- protected override void GetDescriptors(ICollection<BenchmarkOperationDescriptor> descs)
- {
- descs.Add(BenchmarkOperationDescriptor.Create("WriteAddress", WriteAddress, 1));
- //descs.Add(BenchmarkOperationDescriptor.Create("WriteTestModel", WriteTestModel, 1));
- }
-
- /// <summary>
- /// Write address.
- /// </summary>
- /// <param name="state">State.</param>
- private void WriteAddress(BenchmarkState state)
- {
- var mem = _memMgr.Allocate();
-
- try
- {
- var stream = mem.GetStream();
-
- _marsh.StartMarshal(stream).Write(_address);
- }
- finally
- {
- mem.Release();
- }
- }
- /// <summary>
- /// Write address.
- /// </summary>
- /// <param name="state">State.</param>
- private void WriteTestModel(BenchmarkState state)
- {
- var mem = _memMgr.Allocate();
-
- try
- {
- var stream = mem.GetStream();
-
- _marsh.StartMarshal(stream).Write(_model);
- }
- finally
- {
- mem.Release();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 10b3dcd..a5bb7a8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -84,7 +84,7 @@
<Compile Include="Cache\Store\CacheStoreTest.cs" />
<Compile Include="Cache\Store\CacheTestParallelLoadStore.cs" />
<Compile Include="Cache\Store\CacheTestStore.cs" />
- <Compile Include="Compute\Forked\ForkedPortableClosureTaskTest.cs" />
+ <Compile Include="Compute\Forked\ForkedBinarizableClosureTaskTest.cs" />
<Compile Include="Compute\Forked\ForkedResourceTaskTest.cs" />
<Compile Include="Compute\Forked\ForkedSerializableClosureTaskTest.cs" />
<Compile Include="Compute\Forked\ForkedTaskAdapterTest.cs" />
@@ -94,8 +94,8 @@
<Compile Include="Compute\ComputeMultithreadedTest.cs" />
<Compile Include="Compute\IgniteExceptionTaskSelfTest.cs" />
<Compile Include="Compute\FailoverTaskSelfTest.cs" />
- <Compile Include="Compute\PortableClosureTaskTest.cs" />
- <Compile Include="Compute\PortableTaskTest.cs" />
+ <Compile Include="Compute\BinarizableClosureTaskTest.cs" />
+ <Compile Include="Compute\BinarizableTaskTest.cs" />
<Compile Include="Compute\ResourceTaskTest.cs" />
<Compile Include="Compute\SerializableClosureTaskTest.cs" />
<Compile Include="Compute\TaskAdapterTest.cs" />
@@ -116,21 +116,21 @@
<Compile Include="IgniteManagerTest.cs" />
<Compile Include="MarshallerTest.cs" />
<Compile Include="MessagingTest.cs" />
- <Compile Include="PortableConfigurationTest.cs" />
- <Compile Include="Portable\PortableStructureTest.cs" />
+ <Compile Include="BinaryConfigurationTest.cs" />
+ <Compile Include="Binary\BinaryStructureTest.cs" />
<Compile Include="SerializationTest.cs" />
<Compile Include="IgniteStartStopTest.cs" />
<Compile Include="TestUtils.cs" />
<Compile Include="Memory\InteropMemoryTest.cs" />
- <Compile Include="Portable\PortableApiSelfTest.cs" />
- <Compile Include="Portable\PortableSelfTest.cs" />
+ <Compile Include="Binary\BinaryBuilderSelfTest.cs" />
+ <Compile Include="Binary\BinarySelfTest.cs" />
<Compile Include="Process\IgniteProcess.cs" />
<Compile Include="Process\IgniteProcessConsoleOutputReader.cs" />
<Compile Include="Process\IIgniteProcessOutputReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Query\ImplicitPortablePerson.cs" />
- <Compile Include="Query\NoDefPortablePerson.cs" />
- <Compile Include="Query\PortablePerson.cs" />
+ <Compile Include="Query\ImplicitBinarizablePerson.cs" />
+ <Compile Include="Query\NoDefBinarizablePerson.cs" />
+ <Compile Include="Query\BinarizablePerson.cs" />
<Compile Include="Services\ServicesTest.cs" />
<Compile Include="Services\ServicesTestAsync.cs" />
<Compile Include="Services\ServiceProxyTest.cs" />
@@ -161,7 +161,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Content Include="Config\cache-portables.xml">
+ <Content Include="Config\cache-binarizables.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Config\cache-query-continuous.xml">
@@ -207,7 +207,7 @@
<Content Include="Config\marshaller-invalid.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
- <Content Include="Config\marshaller-portable.xml">
+ <Content Include="Config\marshaller-explicit.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Config\native-client-test-cache-affinity.xml">
@@ -222,7 +222,7 @@
<Content Include="Config\native-client-test-cache.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
- <Content Include="Config\portable.xml">
+ <Content Include="Config\binary.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Config\start-test-grid1.xml">
@@ -241,6 +241,7 @@
</Content>
</ItemGroup>
<ItemGroup>
+ <None Include="Apache.Ignite.Core.Tests.nunit" />
<None Include="Apache.Ignite.Core.Tests.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.nunit
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.nunit b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.nunit
new file mode 100644
index 0000000..7aeb108
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.nunit
@@ -0,0 +1,7 @@
+<NUnitProject>
+ <Settings activeconfig="Debug" />
+ <Config name="Debug" binpathtype="Auto">
+ <assembly path="bin\x64\Debug\Apache.Ignite.Core.Tests.exe" />
+ </Config>
+ <Config name="Release" binpathtype="Auto" />
+</NUnitProject>
\ No newline at end of file
[15/50] [abbrv] ignite git commit: Merge remote-tracking branch
'apache/ignite-1.5' into ignite-1.5
Posted by vo...@apache.org.
Merge remote-tracking branch 'apache/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/388a8921
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/388a8921
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/388a8921
Branch: refs/heads/ignite-1816
Commit: 388a8921032af9e055a021e6f859c030eaaa5ea8
Parents: dbadb45 cb28819
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 10 16:48:14 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 10 16:48:14 2015 -0800
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 34 ++--
.../dht/preloader/GridDhtPartitionDemander.java | 25 ++-
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../org/apache/ignite/stream/StreamAdapter.java | 2 +-
.../store/GridCacheBalancingStoreSelfTest.java | 181 ++++++++++++++++++-
...CacheAtomicReferenceApiSelfAbstractTest.java | 20 +-
modules/rest-http/pom.xml | 11 ++
.../yardstick/config/ignite-store-config.xml | 31 ++--
modules/zookeeper/pom.xml | 2 +-
10 files changed, 265 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
[38/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs
deleted file mode 100644
index 150110f..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs
+++ /dev/null
@@ -1,2157 +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.
- */
-
-// ReSharper disable NonReadonlyMemberInGetHashCode
-// ReSharper disable CompareOfFloatsByEqualityOperator
-// ReSharper disable PossibleInvalidOperationException
-// ReSharper disable UnusedAutoPropertyAccessor.Global
-// ReSharper disable MemberCanBePrivate.Global
-namespace Apache.Ignite.Core.Tests.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Binary;
- using Apache.Ignite.Core.Impl.Binary.IO;
- using NUnit.Framework;
-
- /// <summary>
- ///
- /// </summary>
- [TestFixture]
- public class PortableSelfTest {
- /** */
- private Marshaller _marsh;
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureSetUp]
- public void BeforeTest()
- {
- _marsh = new Marshaller(null);
- }
-
- /**
- * <summary>Check write of primitive boolean.</summary>
- */
- [Test]
- public void TestWritePrimitiveBool()
- {
- Assert.AreEqual(_marsh.Unmarshal<bool>(_marsh.Marshal(false)), false);
- Assert.AreEqual(_marsh.Unmarshal<bool>(_marsh.Marshal(true)), true);
-
- Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal((bool?)false)), false);
- Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal((bool?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive boolean array.</summary>
- */
- [Test]
- public void TestWritePrimitiveBoolArray()
- {
- bool[] vals = { true, false };
-
- Assert.AreEqual(_marsh.Unmarshal<bool[]>(_marsh.Marshal(vals)), vals);
-
- bool?[] vals2 = { true, false };
-
- Assert.AreEqual(_marsh.Unmarshal<bool?[]>(_marsh.Marshal(vals2)), vals2);
- }
-
- /**
- * <summary>Check write of primitive sbyte.</summary>
- */
- [Test]
- public void TestWritePrimitiveSbyte()
- {
- Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal((sbyte)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal(sbyte.MinValue)), sbyte.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal(sbyte.MaxValue)), sbyte.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal((sbyte?)1)), (sbyte?)1);
- Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal((sbyte?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive sbyte array.</summary>
- */
- [Test]
- public void TestWritePrimitiveSbyteArray()
- {
- sbyte[] vals = { sbyte.MinValue, 0, 1, sbyte.MaxValue };
- sbyte[] newVals = _marsh.Unmarshal<sbyte[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive byte.</summary>
- */
- [Test]
- public void TestWritePrimitiveByte()
- {
- Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal((byte)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal(byte.MinValue)), byte.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal(byte.MaxValue)), byte.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal((byte?)1)), (byte?)1);
- Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal((byte?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive byte array.</summary>
- */
- [Test]
- public void TestWritePrimitiveByteArray()
- {
- byte[] vals = { byte.MinValue, 0, 1, byte.MaxValue };
- byte[] newVals = _marsh.Unmarshal<byte[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive short.</summary>
- */
- [Test]
- public void TestWritePrimitiveShort()
- {
- Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal((short)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal(short.MinValue)), short.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal(short.MaxValue)), short.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal((short?)1)), (short?)1);
- Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal((short?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive short array.</summary>
- */
- [Test]
- public void TestWritePrimitiveShortArray()
- {
- short[] vals = { short.MinValue, 0, 1, short.MaxValue };
- short[] newVals = _marsh.Unmarshal<short[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive ushort.</summary>
- */
- [Test]
- public void TestWritePrimitiveUshort()
- {
- Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal((ushort)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal(ushort.MinValue)), ushort.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal(ushort.MaxValue)), ushort.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal((ushort?)1)), (ushort?)1);
- Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal((ushort?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive short array.</summary>
- */
- [Test]
- public void TestWritePrimitiveUshortArray()
- {
- ushort[] vals = { ushort.MinValue, 0, 1, ushort.MaxValue };
- ushort[] newVals = _marsh.Unmarshal<ushort[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive char.</summary>
- */
- [Test]
- public void TestWritePrimitiveChar()
- {
- Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal((char)1)), (char)1);
- Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal(char.MinValue)), char.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal(char.MaxValue)), char.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal((char?)1)), (char?)1);
- Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal((char?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive uint array.</summary>
- */
- [Test]
- public void TestWritePrimitiveCharArray()
- {
- char[] vals = { char.MinValue, (char)0, (char)1, char.MaxValue };
- char[] newVals = _marsh.Unmarshal<char[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive int.</summary>
- */
- [Test]
- public void TestWritePrimitiveInt()
- {
- Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(int.MinValue)), int.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(int.MaxValue)), int.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal((int?)1)), (int?)1);
- Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal((int?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive uint array.</summary>
- */
- [Test]
- public void TestWritePrimitiveIntArray()
- {
- int[] vals = { int.MinValue, 0, 1, int.MaxValue };
- int[] newVals = _marsh.Unmarshal<int[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive uint.</summary>
- */
- [Test]
- public void TestWritePrimitiveUint()
- {
- Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal((uint)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal(uint.MinValue)), uint.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal(uint.MaxValue)), uint.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal((uint?)1)), (int?)1);
- Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal((uint?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive uint array.</summary>
- */
- [Test]
- public void TestWritePrimitiveUintArray()
- {
- uint[] vals = { uint.MinValue, 0, 1, uint.MaxValue };
- uint[] newVals = _marsh.Unmarshal<uint[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive long.</summary>
- */
- [Test]
- public void TestWritePrimitiveLong()
- {
- Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal((long)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal(long.MinValue)), long.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal(long.MaxValue)), long.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal((long?)1)), (long?)1);
- Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal((long?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive long array.</summary>
- */
- [Test]
- public void TestWritePrimitiveLongArray()
- {
- long[] vals = { long.MinValue, 0, 1, long.MaxValue };
- long[] newVals = _marsh.Unmarshal<long[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive ulong.</summary>
- */
- [Test]
- public void TestWritePrimitiveUlong()
- {
- Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal((ulong)1)), 1);
- Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal(ulong.MinValue)), ulong.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal(ulong.MaxValue)), ulong.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal((ulong?)1)), (ulong?)1);
- Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal((ulong?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive ulong array.</summary>
- */
- [Test]
- public void TestWritePrimitiveUlongArray()
- {
- ulong[] vals = { ulong.MinValue, 0, 1, ulong.MaxValue };
- ulong[] newVals = _marsh.Unmarshal<ulong[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive float.</summary>
- */
- [Test]
- public void TestWritePrimitiveFloat()
- {
- Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal((float)1)), (float)1);
- Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal(float.MinValue)), float.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal(float.MaxValue)), float.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal((float?)1)), (float?)1);
- Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal((float?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive float array.</summary>
- */
- [Test]
- public void TestWritePrimitiveFloatArray()
- {
- float[] vals = { float.MinValue, 0, 1, float.MaxValue };
- float[] newVals = _marsh.Unmarshal<float[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of primitive double.</summary>
- */
- [Test]
- public void TestWritePrimitiveDouble()
- {
- Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal((double)1)), (double)1);
- Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal(double.MinValue)), double.MinValue);
- Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal(double.MaxValue)), double.MaxValue);
-
- Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal((double?)1)), (double?)1);
- Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal((double?)null)), null);
- }
-
- /**
- * <summary>Check write of primitive double array.</summary>
- */
- [Test]
- public void TestWritePrimitiveDoubleArray()
- {
- double[] vals = { double.MinValue, 0, 1, double.MaxValue };
- double[] newVals = _marsh.Unmarshal<double[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of decimal.</summary>
- */
- [Test]
- public void TestWritePrimitiveDecimal()
- {
- decimal val;
-
- // Test positibe and negative.
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Zero)), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 0, 0, false, 0))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 0, 0, true, 0))), val);
-
- // Test 32, 64 and 96 bits + mixed.
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 1, 0, false, 0))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 1, 0, true, 0))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 0, 1, false, 0))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 0, 1, true, 0))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 1, 1, false, 0))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 1, 1, true, 0))), val);
-
- // Test extremes.
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("65536"))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-65536"))), val);
-
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("4294967296"))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-4294967296"))), val);
-
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("281474976710656"))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-281474976710656"))), val);
-
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("18446744073709551616"))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-18446744073709551616"))), val);
-
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("1208925819614629174706176"))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-1208925819614629174706176"))), val);
-
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.MaxValue)), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.MinValue)), val);
-
- // Test scale.
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("11,12"))), val);
- Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-11,12"))), val);
-
- // Test null.
- Assert.AreEqual(_marsh.Unmarshal<decimal?>(_marsh.Marshal((decimal?)null)), null);
- }
-
- /**
- * <summary>Check write of decimal array.</summary>
- */
- [Test]
- public void TestWritePrimitiveDecimalArray()
- {
- decimal?[] vals = { decimal.One, decimal.Parse("11,12") };
- var newVals = _marsh.Unmarshal<decimal?[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of string.</summary>
- */
- [Test]
- public void TestWriteString()
- {
- Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal("str")), "str");
- Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal((string) null)), null);
- }
-
- /**
- * <summary>Check write of string array.</summary>
- */
- [Test]
- public void TestWriteStringArray()
- {
- string[] vals = { "str1", null, "", "str2", null};
- string[] newVals = _marsh.Unmarshal<string[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of Guid.</summary>
- */
- [Test]
- public void TestWriteGuid()
- {
- Guid guid = Guid.NewGuid();
- Guid? nGuid = guid;
-
- Assert.AreEqual(_marsh.Unmarshal<Guid>(_marsh.Marshal(guid)), guid);
- Assert.AreEqual(_marsh.Unmarshal<Guid?>(_marsh.Marshal(nGuid)), nGuid);
-
- nGuid = null;
-
- // ReSharper disable once ExpressionIsAlwaysNull
- Assert.AreEqual(_marsh.Unmarshal<Guid?>(_marsh.Marshal(nGuid)), null);
- }
-
- /**
- * <summary>Check write of string array.</summary>
- */
- [Test]
- public void TestWriteGuidArray()
- {
- Guid?[] vals = { Guid.NewGuid(), null, Guid.Empty, Guid.NewGuid(), null };
- Guid?[] newVals = _marsh.Unmarshal<Guid?[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /**
- * <summary>Check write of enum.</summary>
- */
- [Test]
- public void TestWriteEnum()
- {
- TestEnum val = TestEnum.Val1;
-
- Assert.AreEqual(_marsh.Unmarshal<TestEnum>(_marsh.Marshal(val)), val);
- }
-
- /**
- * <summary>Check write of enum.</summary>
- */
- [Test]
- public void TestWriteEnumArray()
- {
- TestEnum[] vals = { TestEnum.Val2, TestEnum.Val3 };
- TestEnum[] newVals = _marsh.Unmarshal<TestEnum[]>(_marsh.Marshal(vals));
-
- Assert.AreEqual(vals, newVals);
- }
-
- /// <summary>
- /// Test object with dates.
- /// </summary>
- [Test]
- public void TestDateObject()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(DateTimeType)));
-
- BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
-
- Marshaller marsh = new Marshaller(cfg);
-
- DateTime now = DateTime.Now;
-
- DateTimeType obj = new DateTimeType(now);
-
- DateTimeType otherObj = marsh.Unmarshal<DateTimeType>(marsh.Marshal(obj));
-
- Assert.AreEqual(obj.Utc, otherObj.Utc);
- Assert.AreEqual(obj.UtcNull, otherObj.UtcNull);
- Assert.AreEqual(obj.UtcArr, otherObj.UtcArr);
-
- Assert.AreEqual(obj.UtcRaw, otherObj.UtcRaw);
- Assert.AreEqual(obj.UtcNullRaw, otherObj.UtcNullRaw);
- Assert.AreEqual(obj.UtcArrRaw, otherObj.UtcArrRaw);
- }
-
- /// <summary>
- /// Tests the DateTime marshalling.
- /// </summary>
- [Test]
- public void TestDateTime()
- {
- var time = DateTime.Now;
- Assert.AreEqual(_marsh.Unmarshal<DateTime>(_marsh.Marshal(time)), time);
-
- var timeUtc = DateTime.UtcNow;
- Assert.AreEqual(_marsh.Unmarshal<DateTime>(_marsh.Marshal(timeUtc)), timeUtc);
-
- // Check exception with non-UTC date
- var stream = new BinaryHeapStream(128);
- var writer = _marsh.StartMarshal(stream);
- Assert.Throws<InvalidOperationException>(() => writer.WriteTimestamp(DateTime.Now));
- }
-
- /**
- * <summary>Check generic collections.</summary>
- */
- [Test]
- public void TestGenericCollections()
- {
- var list = new List<string> {"1"};
-
- var data = _marsh.Marshal(list);
-
- var newObjList = _marsh.Unmarshal<IList<string>>(data);
-
- CollectionAssert.AreEquivalent(list, newObjList);
- }
-
- /// <summary>
- /// Tests marshal aware type with generic collections.
- /// </summary>
- [Test]
- public void TestGenericCollectionsType()
- {
- var marsh = new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (PrimitiveFieldType)),
- new BinaryTypeConfiguration(typeof (GenericCollectionsType<PrimitiveFieldType, SerializableObject>))
- }
- });
-
- var obj = new GenericCollectionsType<PrimitiveFieldType, SerializableObject>
- {
- Keys = new[] {new PrimitiveFieldType(), new PrimitiveFieldType()},
- Values =
- new List<SerializableObject>
- {
- new SerializableObject {Foo = 1},
- new SerializableObject {Foo = 5}
- },
- Pairs = new Dictionary<PrimitiveFieldType, SerializableObject>
- {
- {new PrimitiveFieldType(), new SerializableObject {Foo = 10}},
- {new PrimitiveFieldType {PByte = 10}, new SerializableObject {Foo = 20}}
- },
- Objects = new object[] {1, 2, "3", 4.4}
- };
-
- var data = marsh.Marshal(obj);
-
- var result = marsh.Unmarshal<GenericCollectionsType<PrimitiveFieldType, SerializableObject>>(data);
-
- CollectionAssert.AreEquivalent(obj.Keys, result.Keys);
- CollectionAssert.AreEquivalent(obj.Values, result.Values);
- CollectionAssert.AreEquivalent(obj.Pairs, result.Pairs);
- CollectionAssert.AreEquivalent(obj.Objects, result.Objects);
- }
-
- /**
- * <summary>Check property read.</summary>
- */
- [Test]
- public void TestProperty()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(PropertyType)));
-
- BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
-
- Marshaller marsh = new Marshaller(cfg);
-
- PropertyType obj = new PropertyType
- {
- Field1 = 1,
- Field2 = 2
- };
-
- byte[] data = marsh.Marshal(obj);
-
- PropertyType newObj = marsh.Unmarshal<PropertyType>(data);
-
- Assert.AreEqual(obj.Field1, newObj.Field1);
- Assert.AreEqual(obj.Field2, newObj.Field2);
-
- IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
-
- Assert.AreEqual(obj.Field1, portNewObj.GetField<int>("field1"));
- Assert.AreEqual(obj.Field2, portNewObj.GetField<int>("Field2"));
- }
-
- /**
- * <summary>Check write of primitive fields through reflection.</summary>
- */
- [Test]
- public void TestPrimitiveFieldsReflective()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldType)));
-
- BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
-
- Marshaller marsh = new Marshaller(cfg);
-
- PrimitiveFieldType obj = new PrimitiveFieldType();
-
- CheckPrimitiveFields(marsh, obj);
- }
-
- /**
- * <summary>Check write of primitive fields through portable interface.</summary>
- */
- [Test]
- public void TestPrimitiveFieldsPortable()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldPortableType)));
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = typeCfgs;
-
- Marshaller marsh = new Marshaller(cfg);
-
- PrimitiveFieldPortableType obj = new PrimitiveFieldPortableType();
-
- CheckPrimitiveFields(marsh, obj);
- }
-
- /**
- * <summary>Check write of primitive fields through portable interface.</summary>
- */
- [Test]
- public void TestPrimitiveFieldsRawPortable()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldRawPortableType)));
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = typeCfgs;
-
- Marshaller marsh = new Marshaller(cfg);
-
- PrimitiveFieldRawPortableType obj = new PrimitiveFieldRawPortableType();
-
- CheckPrimitiveFields(marsh, obj);
- }
-
- /**
- * <summary>Check write of primitive fields through portable interface.</summary>
- */
- [Test]
- public void TestPrimitiveFieldsSerializer()
- {
- var typeCfgs = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (PrimitiveFieldType))
- {
- Serializer = new PrimitiveFieldsSerializer()
- }
- };
-
- BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
-
- Marshaller marsh = new Marshaller(cfg);
-
- PrimitiveFieldType obj = new PrimitiveFieldType();
-
- CheckPrimitiveFields(marsh, obj);
- }
-
- /**
- * <summary>Check decimals.</summary>
- */
- [Test]
- public void TestDecimalFields()
- {
- BinaryConfiguration cfg = new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (DecimalReflective)),
- new BinaryTypeConfiguration(typeof (DecimalMarshalAware))
- }
- };
-
- Marshaller marsh = new Marshaller(cfg);
-
- // 1. Test reflective stuff.
- DecimalReflective obj1 = new DecimalReflective
- {
- Val = decimal.Zero,
- ValArr = new decimal?[] {decimal.One, decimal.MinusOne}
- };
-
- IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(marsh.Marshal(obj1), BinaryMode.ForceBinary);
-
- Assert.AreEqual(obj1.Val, portObj.GetField<decimal>("val"));
- Assert.AreEqual(obj1.ValArr, portObj.GetField<decimal?[]>("valArr"));
-
- Assert.AreEqual(obj1.Val, portObj.Deserialize<DecimalReflective>().Val);
- Assert.AreEqual(obj1.ValArr, portObj.Deserialize<DecimalReflective>().ValArr);
-
- // 2. Test marshal aware stuff.
- DecimalMarshalAware obj2 = new DecimalMarshalAware();
-
- obj2.Val = decimal.Zero;
- obj2.ValArr = new decimal?[] { decimal.One, decimal.MinusOne };
- obj2.RawVal = decimal.MaxValue;
- obj2.RawValArr = new decimal?[] { decimal.MinusOne, decimal.One} ;
-
- portObj = marsh.Unmarshal<IBinaryObject>(marsh.Marshal(obj2), BinaryMode.ForceBinary);
-
- Assert.AreEqual(obj2.Val, portObj.GetField<decimal>("val"));
- Assert.AreEqual(obj2.ValArr, portObj.GetField<decimal?[]>("valArr"));
-
- Assert.AreEqual(obj2.Val, portObj.Deserialize<DecimalMarshalAware>().Val);
- Assert.AreEqual(obj2.ValArr, portObj.Deserialize<DecimalMarshalAware>().ValArr);
- Assert.AreEqual(obj2.RawVal, portObj.Deserialize<DecimalMarshalAware>().RawVal);
- Assert.AreEqual(obj2.RawValArr, portObj.Deserialize<DecimalMarshalAware>().RawValArr);
- }
-
- /**
- * <summary>Check write of primitive fields through raw serializer.</summary>
- */
- [Test]
- public void TestPrimitiveFieldsRawSerializer()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- BinaryTypeConfiguration typeCfg =
- new BinaryTypeConfiguration(typeof(PrimitiveFieldType));
-
- typeCfg.Serializer = new PrimitiveFieldsRawSerializer();
-
- typeCfgs.Add(typeCfg);
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = typeCfgs;
-
- Marshaller marsh = new Marshaller(cfg);
-
- PrimitiveFieldType obj = new PrimitiveFieldType();
-
- CheckPrimitiveFields(marsh, obj);
- }
-
- private void CheckPrimitiveFields(Marshaller marsh, PrimitiveFieldType obj)
- {
- obj.PBool = true;
- obj.PByte = 2;
- obj.PSbyte = 3;
- obj.PShort = 4;
- obj.PUshort = 5;
- obj.PInt = 6;
- obj.PUint = 7;
- obj.PLong = 8;
- obj.PUlong = 9;
- obj.PChar = 'a';
- obj.PFloat = 10;
- obj.PDouble = 11;
- obj.PString = "abc";
- obj.PGuid = Guid.NewGuid();
- obj.PnGuid = Guid.NewGuid();
- obj.IgniteGuid = new IgniteGuid(Guid.NewGuid(), 123);
-
- CheckPrimitiveFieldsSerialization(marsh, obj);
- }
-
- private void CheckPrimitiveFieldsSerialization(Marshaller marsh, PrimitiveFieldType obj)
- {
- byte[] bytes = marsh.Marshal(obj);
-
- IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
-
- PrimitiveFieldType newObj = portObj.Deserialize<PrimitiveFieldType>();
-
- Assert.AreEqual(obj, newObj);
- }
-
- /**
- * <summary>Check write of object with enums.</summary>
- */
- [Test]
- public void TestEnumsReflective()
- {
- Marshaller marsh =
- new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations =
- new List<BinaryTypeConfiguration> {new BinaryTypeConfiguration(typeof (EnumType))}
- });
-
- EnumType obj = new EnumType
- {
- PEnum = TestEnum.Val1,
- PEnumArray = new[] {TestEnum.Val2, TestEnum.Val3}
- };
-
- byte[] bytes = marsh.Marshal(obj);
-
- IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
-
- EnumType newObj = portObj.Deserialize<EnumType>();
-
- Assert.AreEqual(obj.PEnum, newObj.PEnum);
- Assert.AreEqual(obj.PEnumArray, newObj.PEnumArray);
- }
-
- /**
- * <summary>Check write of object with collections.</summary>
- */
- [Test]
- public void TestCollectionsReflective()
- {
- var marsh = new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (CollectionsType)),
- new BinaryTypeConfiguration(typeof (InnerObjectType))
- }
- });
-
- var obj = new CollectionsType
- {
- Hashtable = new Hashtable {{1, 2}, {3, 4}},
- LinkedList = new LinkedList<int>(new[] {1, 2, 3}),
- SortedDict = new SortedDictionary<string, int> {{"1", 2}},
- Dict = new Dictionary<int, string> {{1, "2"}},
- Arr = new[] {new InnerObjectType()}
- };
-
- var list = new ArrayList
- {
- true,
- (byte) 1,
- (short) 2,
- 'a',
- 3,
- (long) 4,
- (float) 5,
- (double) 6,
- "string",
- Guid.NewGuid(),
- new InnerObjectType
- {
- PInt1 = 1,
- PInt2 = 2
- }
- };
-
- obj.Col1 = list;
-
- byte[] bytes = marsh.Marshal(obj);
-
- IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
-
- CollectionsType newObj = portObj.Deserialize<CollectionsType>();
-
- Assert.AreEqual(obj, newObj);
-
- obj.Col1 = null;
-
- Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
-
- obj.Col1 = list;
- obj.Col2 = list;
-
- Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
-
- obj.Col2 = new TestList();
-
- Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
- }
-
- /**
- * <summary>Check write of object fields through reflective serializer.</summary>
- */
- [Test]
- public void TestObjectReflective()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(OuterObjectType)));
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(InnerObjectType)));
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = typeCfgs;
-
- Marshaller marsh = new Marshaller(cfg);
-
- CheckObject(marsh, new OuterObjectType(), new InnerObjectType());
- }
-
- /**
- * <summary>Test handles.</summary>
- */
- [Test]
- public void TestHandles()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(HandleInner)));
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(HandleOuter)));
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = typeCfgs;
-
- Marshaller marsh = new Marshaller(cfg);
-
- HandleOuter outer = new HandleOuter();
-
- outer.Before = "outBefore";
- outer.After = "outAfter";
- outer.RawBefore = "outRawBefore";
- outer.RawAfter = "outRawAfter";
-
- HandleInner inner = new HandleInner();
-
- inner.Before = "inBefore";
- inner.After = "inAfter";
- inner.RawBefore = "inRawBefore";
- inner.RawAfter = "inRawAfter";
-
- outer.Inner = inner;
- outer.RawInner = inner;
-
- inner.Outer = outer;
- inner.RawOuter = outer;
-
- byte[] bytes = marsh.Marshal(outer);
-
- IBinaryObject outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- HandleOuter newOuter = outerObj.Deserialize<HandleOuter>();
- HandleInner newInner = newOuter.Inner;
-
- CheckHandlesConsistency(outer, inner, newOuter, newInner);
-
- // Get inner object by field.
- IBinaryObject innerObj = outerObj.GetField<IBinaryObject>("inner");
-
- newInner = innerObj.Deserialize<HandleInner>();
- newOuter = newInner.Outer;
-
- CheckHandlesConsistency(outer, inner, newOuter, newInner);
-
- // Get outer object from inner object by handle.
- outerObj = innerObj.GetField<IBinaryObject>("outer");
-
- newOuter = outerObj.Deserialize<HandleOuter>();
- newInner = newOuter.Inner;
-
- CheckHandlesConsistency(outer, inner, newOuter, newInner);
- }
-
- /**
- * <summary>Test handles with exclusive writes.</summary>
- */
- [Test]
- public void TestHandlesExclusive([Values(true, false)] bool detached, [Values(true, false)] bool asPortable)
- {
- var marsh = new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (HandleInner)),
- new BinaryTypeConfiguration(typeof (HandleOuterExclusive))
- }
- });
-
- var inner = new HandleInner
- {
- Before = "inBefore",
- After = "inAfter",
- RawBefore = "inRawBefore",
- RawAfter = "inRawAfter"
- };
-
- var outer = new HandleOuterExclusive
- {
- Before = "outBefore",
- After = "outAfter",
- RawBefore = "outRawBefore",
- RawAfter = "outRawAfter",
- Inner = inner,
- RawInner = inner
- };
-
- inner.Outer = outer;
- inner.RawOuter = outer;
-
- var bytes = asPortable
- ? marsh.Marshal(new IgniteBinary(marsh).ToBinary<IBinaryObject>(outer))
- : marsh.Marshal(outer);
-
- IBinaryObject outerObj;
-
- if (detached)
- {
- var reader = new BinaryReader(marsh, new Dictionary<long, IBinaryTypeDescriptor>(),
- new BinaryHeapStream(bytes), BinaryMode.ForceBinary, null);
-
- reader.DetachNext();
-
- outerObj = reader.Deserialize<IBinaryObject>();
- }
- else
- outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- HandleOuter newOuter = outerObj.Deserialize<HandleOuter>();
-
- Assert.IsFalse(newOuter == newOuter.Inner.Outer);
- Assert.IsFalse(newOuter == newOuter.Inner.RawOuter);
- Assert.IsFalse(newOuter == newOuter.RawInner.RawOuter);
- Assert.IsFalse(newOuter == newOuter.RawInner.RawOuter);
-
- Assert.IsFalse(newOuter.Inner == newOuter.RawInner);
-
- Assert.IsTrue(newOuter.Inner.Outer == newOuter.Inner.RawOuter);
- Assert.IsTrue(newOuter.RawInner.Outer == newOuter.RawInner.RawOuter);
-
- Assert.IsTrue(newOuter.Inner == newOuter.Inner.Outer.Inner);
- Assert.IsTrue(newOuter.Inner == newOuter.Inner.Outer.RawInner);
- Assert.IsTrue(newOuter.RawInner == newOuter.RawInner.Outer.Inner);
- Assert.IsTrue(newOuter.RawInner == newOuter.RawInner.Outer.RawInner);
- }
-
- ///
- /// <summary>Test KeepSerialized property</summary>
- ///
- [Test]
- public void TestKeepSerializedDefault()
- {
- CheckKeepSerialized(new BinaryConfiguration(), true);
- }
-
- ///
- /// <summary>Test KeepSerialized property</summary>
- ///
- [Test]
- public void TestKeepSerializedDefaultFalse()
- {
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.DefaultKeepDeserialized = false;
-
- CheckKeepSerialized(cfg, false);
- }
-
- ///
- /// <summary>Test KeepSerialized property</summary>
- ///
- [Test]
- public void TestKeepSerializedTypeCfgFalse()
- {
- BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(PropertyType));
-
- typeCfg.KeepDeserialized = false;
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg };
-
- CheckKeepSerialized(cfg, false);
- }
-
- ///
- /// <summary>Test KeepSerialized property</summary>
- ///
- [Test]
- public void TestKeepSerializedTypeCfgTrue()
- {
- BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(PropertyType));
- typeCfg.KeepDeserialized = true;
-
- BinaryConfiguration cfg = new BinaryConfiguration();
- cfg.DefaultKeepDeserialized = false;
-
- cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg };
-
- CheckKeepSerialized(cfg, true);
- }
-
- /// <summary>
- /// Test correct serialization/deserialization of arrays of special types.
- /// </summary>
- [Test]
- public void TestSpecialArrays()
- {
- ICollection<BinaryTypeConfiguration> typeCfgs =
- new List<BinaryTypeConfiguration>();
-
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(SpecialArray)));
- typeCfgs.Add(new BinaryTypeConfiguration(typeof(SpecialArrayMarshalAware)));
-
- BinaryConfiguration cfg = new BinaryConfiguration();
-
- cfg.TypeConfigurations = typeCfgs;
-
- Marshaller marsh = new Marshaller(cfg);
-
- Guid[] guidArr = { Guid.NewGuid() };
- Guid?[] nGuidArr = { Guid.NewGuid() };
- DateTime[] dateArr = { DateTime.Now.ToUniversalTime() };
- DateTime?[] nDateArr = { DateTime.Now.ToUniversalTime() };
-
- // Use special object.
- SpecialArray obj1 = new SpecialArray
- {
- GuidArr = guidArr,
- NGuidArr = nGuidArr,
- DateArr = dateArr,
- NDateArr = nDateArr
- };
-
- byte[] bytes = marsh.Marshal(obj1);
-
- IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- Assert.IsNotNull(portObj.Deserialize<SpecialArray>());
-
- Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("guidArr"));
- Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("nGuidArr"));
- Assert.AreEqual(dateArr, portObj.GetField<DateTime[]>("dateArr"));
- Assert.AreEqual(nDateArr, portObj.GetField<DateTime?[]>("nDateArr"));
-
- obj1 = portObj.Deserialize<SpecialArray>();
-
- Assert.AreEqual(guidArr, obj1.GuidArr);
- Assert.AreEqual(nGuidArr, obj1.NGuidArr);
- Assert.AreEqual(dateArr, obj1.DateArr);
- Assert.AreEqual(nDateArr, obj1.NDateArr);
-
- // Use special with IGridPortableMarshalAware.
- SpecialArrayMarshalAware obj2 = new SpecialArrayMarshalAware();
-
- obj2.GuidArr = guidArr;
- obj2.NGuidArr = nGuidArr;
- obj2.DateArr = dateArr;
- obj2.NDateArr = nDateArr;
-
- bytes = marsh.Marshal(obj2);
-
- portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("a"));
- Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("b"));
- Assert.AreEqual(dateArr, portObj.GetField<DateTime[]>("c"));
- Assert.AreEqual(nDateArr, portObj.GetField<DateTime?[]>("d"));
-
- obj2 = portObj.Deserialize<SpecialArrayMarshalAware>();
-
- Assert.AreEqual(guidArr, obj2.GuidArr);
- Assert.AreEqual(nGuidArr, obj2.NGuidArr);
- Assert.AreEqual(dateArr, obj2.DateArr);
- Assert.AreEqual(nDateArr, obj2.NDateArr);
- }
-
- /// <summary>
- /// Writes objects of various sizes to test schema compaction
- /// (where field offsets can be stored as 1, 2 or 4 bytes).
- /// </summary>
- [Test]
- public void TestCompactSchema()
- {
- var marsh = new Marshaller(new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (SpecialArray)),
- new BinaryTypeConfiguration(typeof (SpecialArrayMarshalAware))
- }
- });
-
- var dt = new SpecialArrayMarshalAware();
-
- foreach (var i in new[] {1, 5, 10, 13, 14, 15, 100, 200, 1000, 5000, 15000, 30000})
- {
- dt.NGuidArr = Enumerable.Range(1, i).Select(x => (Guid?) Guid.NewGuid()).ToArray();
- dt.NDateArr = Enumerable.Range(1, i).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray();
-
- var bytes = marsh.Marshal(dt);
-
- var res = marsh.Unmarshal<SpecialArrayMarshalAware>(bytes);
-
- CollectionAssert.AreEquivalent(dt.NGuidArr, res.NGuidArr);
- CollectionAssert.AreEquivalent(dt.NDateArr, res.NDateArr);
- }
- }
-
- private static void CheckKeepSerialized(BinaryConfiguration cfg, bool expKeep)
- {
- if (cfg.TypeConfigurations == null)
- {
- cfg.TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof(PropertyType))
- };
- }
-
- Marshaller marsh = new Marshaller(cfg);
-
- byte[] data = marsh.Marshal(new PropertyType());
-
- IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
-
- PropertyType deserialized1 = portNewObj.Deserialize<PropertyType>();
- PropertyType deserialized2 = portNewObj.Deserialize<PropertyType>();
-
- Assert.NotNull(deserialized1);
-
- Assert.AreEqual(expKeep, deserialized1 == deserialized2);
- }
-
- private void CheckHandlesConsistency(HandleOuter outer, HandleInner inner, HandleOuter newOuter,
- HandleInner newInner)
- {
- Assert.True(newOuter != null);
- Assert.AreEqual(outer.Before, newOuter.Before);
- Assert.True(newOuter.Inner == newInner);
- Assert.AreEqual(outer.After, newOuter.After);
- Assert.AreEqual(outer.RawBefore, newOuter.RawBefore);
- Assert.True(newOuter.RawInner == newInner);
- Assert.AreEqual(outer.RawAfter, newOuter.RawAfter);
-
- Assert.True(newInner != null);
- Assert.AreEqual(inner.Before, newInner.Before);
- Assert.True(newInner.Outer == newOuter);
- Assert.AreEqual(inner.After, newInner.After);
- Assert.AreEqual(inner.RawBefore, newInner.RawBefore);
- Assert.True(newInner.RawOuter == newOuter);
- Assert.AreEqual(inner.RawAfter, newInner.RawAfter);
- }
-
- private static void CheckObject(Marshaller marsh, OuterObjectType outObj, InnerObjectType inObj)
- {
- inObj.PInt1 = 1;
- inObj.PInt2 = 2;
-
- outObj.InObj = inObj;
-
- byte[] bytes = marsh.Marshal(outObj);
-
- IBinaryObject portOutObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
-
- Assert.AreEqual(outObj.GetHashCode(), portOutObj.GetHashCode());
-
- OuterObjectType newOutObj = portOutObj.Deserialize<OuterObjectType>();
-
- Assert.AreEqual(outObj, newOutObj);
- }
-
- public class OuterObjectType
- {
- public InnerObjectType InObj { get; set; }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
-
- var type = obj as OuterObjectType;
-
- return type != null && Equals(InObj, type.InObj);
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return InObj != null ? InObj.GetHashCode() : 0;
- }
- }
-
- [Serializable]
- public class InnerObjectType
- {
- public int PInt1 { get; set; }
-
- public int PInt2 { get; set; }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
-
- var that = obj as InnerObjectType;
-
- return that != null && (PInt1 == that.PInt1 && PInt2 == that.PInt2);
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return 31 * PInt1 + PInt2;
- }
-
- /** <inheritdoc /> */
- public override string ToString()
- {
- return "InnerObjectType[pInt1=" + PInt1 + ", pInt2=" + PInt2 + ']';
- }
- }
-
- public class CollectionsType
- {
- public ICollection Col1 { get; set; }
-
- public ArrayList Col2 { get; set; }
-
- public Hashtable Hashtable { get; set; }
-
- public Dictionary<int, string> Dict { get; set; }
-
- public InnerObjectType[] Arr { get; set; }
-
- public SortedDictionary<string, int> SortedDict { get; set; }
-
- public LinkedList<int> LinkedList { get; set; }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
-
- var that = obj as CollectionsType;
-
- return that != null
- && CompareCollections(Col1, that.Col1)
- && CompareCollections(Col2, that.Col2)
- && CompareCollections(Hashtable, that.Hashtable)
- && CompareCollections(Dict, that.Dict)
- && CompareCollections(Arr, that.Arr)
- && CompareCollections(SortedDict, that.SortedDict)
- && CompareCollections(LinkedList, that.LinkedList);
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- int res = 0;
-
- foreach (var col in new object[] {Col1, Col2, Hashtable, Dict, Arr, SortedDict, LinkedList})
- res = 31*res + (col != null ? col.GetHashCode() : 0);
-
- return res;
- }
- }
-
- public class GenericCollectionsType<TKey, TValue> : IBinarizable
- {
- public ICollection<TKey> Keys { get; set; }
-
- public ICollection<TValue> Values { get; set; }
-
- public IDictionary<TKey, TValue> Pairs { get; set; }
-
- public ICollection<object> Objects { get; set; }
-
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteObject("Keys", Keys);
- writer.WriteObject("Values", Values);
- writer.WriteObject("Pairs", Pairs);
- writer.WriteObject("Objects", Objects);
- }
-
- public void ReadBinary(IBinaryReader reader)
- {
- Keys = (ICollection<TKey>) reader.ReadObject<object>("Keys");
- Values = (ICollection<TValue>) reader.ReadObject<object>("Values");
- Pairs = (IDictionary<TKey, TValue>) reader.ReadObject<object>("Pairs");
- Objects = (ICollection<object>) reader.ReadObject<object>("Objects");
- }
- }
-
- public class TestList : ArrayList
- {
-
- }
-
- private static bool CompareCollections(ICollection col1, ICollection col2)
- {
- if (col1 == null && col2 == null)
- return true;
- if (col1 == null || col2 == null)
- return false;
-
- return col1.OfType<object>().SequenceEqual(col2.OfType<object>());
- }
-
- public class PrimitiveArrayFieldType
- {
- public bool[] PBool { get; set; }
-
- public sbyte[] PSbyte { get; set; }
-
- public byte[] PByte { get; set; }
-
- public short[] PShort { get; set; }
-
- public ushort[] PUshort { get; set; }
-
- public char[] PChar { get; set; }
-
- public int[] PInt { get; set; }
-
- public uint[] PUint { get; set; }
-
- public long[] PLong { get; set; }
-
- public ulong[] PUlong { get; set; }
-
- public float[] PFloat { get; set; }
-
- public double[] PDouble { get; set; }
-
- public string[] PString { get; set; }
-
- public Guid?[] PGuid { get; set; }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
-
- var other = obj as PrimitiveArrayFieldType;
-
- return other != null && (PBool == other.PBool &&
- PByte == other.PByte &&
- PSbyte == other.PSbyte &&
- PShort == other.PShort &&
- PUshort == other.PUshort &&
- PInt == other.PInt &&
- PUint == other.PUint &&
- PLong == other.PLong &&
- PUlong == other.PUlong &&
- PChar == other.PChar &&
- PFloat == other.PFloat &&
- PDouble == other.PDouble &&
- PString == other.PString &&
- PGuid == other.PGuid);
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return PInt != null && PInt.Length > 0 ? PInt[0].GetHashCode() : 0;
- }
- }
-
- public class SpecialArray
- {
- public Guid[] GuidArr;
- public Guid?[] NGuidArr;
- public DateTime[] DateArr;
- public DateTime?[] NDateArr;
- }
-
- public class SpecialArrayMarshalAware : SpecialArray, IBinarizable
- {
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteObject("a", GuidArr);
- writer.WriteObject("b", NGuidArr);
- writer.WriteObject("c", DateArr);
- writer.WriteObject("d", NDateArr);
- }
-
- public void ReadBinary(IBinaryReader reader)
- {
- GuidArr = reader.ReadObject<Guid[]>("a");
- NGuidArr = reader.ReadObject<Guid?[]>("b");
- DateArr = reader.ReadObject<DateTime[]>("c");
- NDateArr = reader.ReadObject<DateTime?[]>("d");
- }
- }
-
- public class EnumType
- {
- public TestEnum PEnum { get; set; }
-
- public TestEnum[] PEnumArray { get; set; }
- }
-
- [Serializable]
- public class PrimitiveFieldType
- {
- public bool PBool { get; set; }
-
- public sbyte PSbyte { get; set; }
-
- public byte PByte { get; set; }
-
- public short PShort { get; set; }
-
- public ushort PUshort { get; set; }
-
- public char PChar { get; set; }
-
- public int PInt { get; set; }
-
- public uint PUint { get; set; }
-
- public long PLong { get; set; }
-
- public ulong PUlong { get; set; }
-
- public float PFloat { get; set; }
-
- public double PDouble { get; set; }
-
- public string PString { get; set; }
-
- public Guid PGuid { get; set; }
-
- public Guid? PnGuid { get; set; }
-
- public IgniteGuid IgniteGuid { get; set; }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
-
- if (obj != null && obj is PrimitiveFieldType)
- {
- PrimitiveFieldType that = (PrimitiveFieldType)obj;
-
- return PBool == that.PBool &&
- PByte == that.PByte &&
- PSbyte == that.PSbyte &&
- PShort == that.PShort &&
- PUshort == that.PUshort &&
- PInt == that.PInt &&
- PUint == that.PUint &&
- PLong == that.PLong &&
- PUlong == that.PUlong &&
- PChar == that.PChar &&
- PFloat == that.PFloat &&
- PDouble == that.PDouble &&
- (string.Equals(PString, that.PString)) &&
- PGuid.Equals(that.PGuid) &&
- IgniteGuid.Equals(that.IgniteGuid) &&
- (PnGuid == null && that.PnGuid == null || PnGuid != null && PnGuid.Equals(that.PnGuid));
- }
- return false;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return PInt;
- }
- }
-
- public class PrimitiveFieldPortableType : PrimitiveFieldType, IBinarizable
- {
- public unsafe void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteBoolean("bool", PBool);
- writer.WriteByte("byte", PByte);
- writer.WriteShort("short", PShort);
- writer.WriteInt("int", PInt);
- writer.WriteLong("long", PLong);
- writer.WriteChar("char", PChar);
- writer.WriteFloat("float", PFloat);
- writer.WriteDouble("double", PDouble);
-
- sbyte sByte = PSbyte;
- ushort uShort = PUshort;
- uint uInt = PUint;
- ulong uLong = PUlong;
-
- writer.WriteByte("sbyte", *(byte*)&sByte);
- writer.WriteShort("ushort", *(short*)&uShort);
- writer.WriteInt("uint", *(int*)&uInt);
- writer.WriteLong("ulong", *(long*)&uLong);
-
- writer.WriteString("string", PString);
- writer.WriteGuid("guid", PGuid);
- writer.WriteGuid("nguid", PnGuid);
-
- writer.WriteObject("iguid", IgniteGuid);
- }
-
- public unsafe void ReadBinary(IBinaryReader reader)
- {
- PBool = reader.ReadBoolean("bool");
- PByte = reader.ReadByte("byte");
- PShort = reader.ReadShort("short");
- PInt = reader.ReadInt("int");
-
- PLong = reader.ReadLong("long");
- PChar = reader.ReadChar("char");
- PFloat = reader.ReadFloat("float");
- PDouble = reader.ReadDouble("double");
-
- byte sByte = reader.ReadByte("sbyte");
- short uShort = reader.ReadShort("ushort");
- int uInt = reader.ReadInt("uint");
- long uLong = reader.ReadLong("ulong");
-
- PSbyte = *(sbyte*)&sByte;
- PUshort = *(ushort*)&uShort;
- PUint = *(uint*)&uInt;
- PUlong = *(ulong*)&uLong;
-
- PString = reader.ReadString("string");
- PGuid = reader.ReadObject<Guid>("guid");
- PnGuid = reader.ReadGuid("nguid");
-
- IgniteGuid = reader.ReadObject<IgniteGuid>("iguid");
- }
- }
-
- public class PrimitiveFieldRawPortableType : PrimitiveFieldType, IBinarizable
- {
- public unsafe void WriteBinary(IBinaryWriter writer)
- {
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteBoolean(PBool);
- rawWriter.WriteByte(PByte);
- rawWriter.WriteShort(PShort);
- rawWriter.WriteInt(PInt);
- rawWriter.WriteLong(PLong);
- rawWriter.WriteChar(PChar);
- rawWriter.WriteFloat(PFloat);
- rawWriter.WriteDouble(PDouble);
-
- sbyte sByte = PSbyte;
- ushort uShort = PUshort;
- uint uInt = PUint;
- ulong uLong = PUlong;
-
- rawWriter.WriteByte(*(byte*)&sByte);
- rawWriter.WriteShort(*(short*)&uShort);
- rawWriter.WriteInt(*(int*)&uInt);
- rawWriter.WriteLong(*(long*)&uLong);
-
- rawWriter.WriteString(PString);
- rawWriter.WriteGuid(PGuid);
- rawWriter.WriteGuid(PnGuid);
-
- rawWriter.WriteObject(IgniteGuid);
- }
-
- public unsafe void ReadBinary(IBinaryReader reader)
- {
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- PBool = rawReader.ReadBoolean();
- PByte = rawReader.ReadByte();
- PShort = rawReader.ReadShort();
- PInt = rawReader.ReadInt();
-
- PLong = rawReader.ReadLong();
- PChar = rawReader.ReadChar();
- PFloat = rawReader.ReadFloat();
- PDouble = rawReader.ReadDouble();
-
- byte sByte = rawReader.ReadByte();
- short uShort = rawReader.ReadShort();
- int uInt = rawReader.ReadInt();
- long uLong = rawReader.ReadLong();
-
- PSbyte = *(sbyte*)&sByte;
- PUshort = *(ushort*)&uShort;
- PUint = *(uint*)&uInt;
- PUlong = *(ulong*)&uLong;
-
- PString = rawReader.ReadString();
- PGuid = rawReader.ReadGuid().Value;
- PnGuid = rawReader.ReadGuid();
-
- IgniteGuid = rawReader.ReadObject<IgniteGuid>();
- }
- }
-
- public class PrimitiveFieldsSerializer : IBinarySerializer
- {
- public unsafe void WriteBinary(object obj, IBinaryWriter writer)
- {
- PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
-
- writer.WriteBoolean("bool", obj0.PBool);
- writer.WriteByte("byte", obj0.PByte);
- writer.WriteShort("short", obj0.PShort);
- writer.WriteInt("int", obj0.PInt);
- writer.WriteLong("long", obj0.PLong);
- writer.WriteChar("char", obj0.PChar);
- writer.WriteFloat("float", obj0.PFloat);
- writer.WriteDouble("double", obj0.PDouble);
-
- sbyte sByte = obj0.PSbyte;
- ushort uShort = obj0.PUshort;
- uint uInt = obj0.PUint;
- ulong uLong = obj0.PUlong;
-
- writer.WriteByte("sbyte", *(byte*)&sByte);
- writer.WriteShort("ushort", *(short*)&uShort);
- writer.WriteInt("uint", *(int*)&uInt);
- writer.WriteLong("ulong", *(long*)&uLong);
-
- writer.WriteString("string", obj0.PString);
- writer.WriteGuid("guid", obj0.PGuid);
- writer.WriteGuid("nguid", obj0.PnGuid);
-
- writer.WriteObject("iguid", obj0.IgniteGuid);
- }
-
- public unsafe void ReadBinary(object obj, IBinaryReader reader)
- {
- PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
-
- obj0.PBool = reader.ReadBoolean("bool");
- obj0.PByte = reader.ReadByte("byte");
- obj0.PShort = reader.ReadShort("short");
- obj0.PInt = reader.ReadInt("int");
-
- obj0.PLong = reader.ReadLong("long");
- obj0.PChar = reader.ReadChar("char");
- obj0.PFloat = reader.ReadFloat("float");
- obj0.PDouble = reader.ReadDouble("double");
-
- byte sByte = reader.ReadByte("sbyte");
- short uShort = reader.ReadShort("ushort");
- int uInt = reader.ReadInt("uint");
- long uLong = reader.ReadLong("ulong");
-
- obj0.PSbyte = *(sbyte*)&sByte;
- obj0.PUshort = *(ushort*)&uShort;
- obj0.PUint = *(uint*)&uInt;
- obj0.PUlong = *(ulong*)&uLong;
-
- obj0.PString = reader.ReadString("string");
- obj0.PGuid = reader.ReadObject<Guid>("guid");
- obj0.PnGuid = reader.ReadGuid("nguid");
-
- obj0.IgniteGuid = reader.ReadObject<IgniteGuid>("iguid");
- }
- }
-
- public class PrimitiveFieldsRawSerializer : IBinarySerializer
- {
- public unsafe void WriteBinary(object obj, IBinaryWriter writer)
- {
- PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
-
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteBoolean(obj0.PBool);
- rawWriter.WriteByte(obj0.PByte);
- rawWriter.WriteShort( obj0.PShort);
- rawWriter.WriteInt( obj0.PInt);
- rawWriter.WriteLong( obj0.PLong);
- rawWriter.WriteChar(obj0.PChar);
- rawWriter.WriteFloat(obj0.PFloat);
- rawWriter.WriteDouble( obj0.PDouble);
-
- sbyte sByte = obj0.PSbyte;
- ushort uShort = obj0.PUshort;
- uint uInt = obj0.PUint;
- ulong uLong = obj0.PUlong;
-
- rawWriter.WriteByte(*(byte*)&sByte);
- rawWriter.WriteShort(*(short*)&uShort);
- rawWriter.WriteInt(*(int*)&uInt);
- rawWriter.WriteLong(*(long*)&uLong);
-
- rawWriter.WriteString(obj0.PString);
- rawWriter.WriteGuid(obj0.PGuid);
- rawWriter.WriteGuid(obj0.PnGuid);
-
- rawWriter.WriteObject(obj0.IgniteGuid);
- }
-
- public unsafe void ReadBinary(object obj, IBinaryReader reader)
- {
- PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
-
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- obj0.PBool = rawReader.ReadBoolean();
- obj0.PByte = rawReader.ReadByte();
- obj0.PShort = rawReader.ReadShort();
- obj0.PInt = rawReader.ReadInt();
- obj0.PLong = rawReader.ReadLong();
- obj0.PChar = rawReader.ReadChar();
- obj0.PFloat = rawReader.ReadFloat();
- obj0.PDouble = rawReader.ReadDouble();
-
- byte sByte = rawReader.ReadByte();
- short uShort = rawReader.ReadShort();
- int uInt = rawReader.ReadInt();
- long uLong = rawReader.ReadLong();
-
- obj0.PSbyte = *(sbyte*)&sByte;
- obj0.PUshort = *(ushort*)&uShort;
- obj0.PUint = *(uint*)&uInt;
- obj0.PUlong = *(ulong*)&uLong;
-
- obj0.PString = rawReader.ReadString();
- obj0.PGuid = rawReader.ReadGuid().Value;
- obj0.PnGuid = rawReader.ReadGuid();
-
- obj0.IgniteGuid = rawReader.ReadObject<IgniteGuid>();
- }
- }
-
- public class HandleOuter : IBinarizable
- {
- public string Before;
- public HandleInner Inner;
- public string After;
-
- public string RawBefore;
- public HandleInner RawInner;
- public string RawAfter;
-
- /** <inheritdoc /> */
- virtual public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteString("before", Before);
- writer.WriteObject("inner", Inner);
- writer.WriteString("after", After);
-
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteString(RawBefore);
- rawWriter.WriteObject(RawInner);
- rawWriter.WriteString(RawAfter);
- }
-
- /** <inheritdoc /> */
- virtual public void ReadBinary(IBinaryReader reader)
- {
- Before = reader.ReadString("before");
- Inner = reader.ReadObject<HandleInner>("inner");
- After = reader.ReadString("after");
-
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- RawBefore = rawReader.ReadString();
- RawInner = rawReader.ReadObject<HandleInner>();
- RawAfter = rawReader.ReadString();
- }
- }
-
- public class HandleInner : IBinarizable
- {
- public string Before;
- public HandleOuter Outer;
- public string After;
-
- public string RawBefore;
- public HandleOuter RawOuter;
- public string RawAfter;
-
- /** <inheritdoc /> */
- virtual public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteString("before", Before);
- writer.WriteObject("outer", Outer);
- writer.WriteString("after", After);
-
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteString(RawBefore);
- rawWriter.WriteObject(RawOuter);
- rawWriter.WriteString(RawAfter);
- }
-
- /** <inheritdoc /> */
- virtual public void ReadBinary(IBinaryReader reader)
- {
- Before = reader.ReadString("before");
- Outer = reader.ReadObject<HandleOuter>("outer");
- After = reader.ReadString("after");
-
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- RawBefore = rawReader.ReadString();
- RawOuter = rawReader.ReadObject<HandleOuter>();
- RawAfter = rawReader.ReadString();
- }
- }
-
-
- public class HandleOuterExclusive : HandleOuter
- {
- /** <inheritdoc /> */
- override public void WriteBinary(IBinaryWriter writer)
- {
- BinaryWriter writer0 = (BinaryWriter)writer;
-
- writer.WriteString("before", Before);
-
- writer0.WithDetach(w => w.WriteObject("inner", Inner));
-
- writer.WriteString("after", After);
-
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteString(RawBefore);
-
- writer0.WithDetach(w => w.WriteObject(RawInner));
-
- rawWriter.WriteString(RawAfter);
- }
-
- /** <inheritdoc /> */
- override public void ReadBinary(IBinaryReader reader)
- {
- var reader0 = (BinaryReader) reader;
-
- Before = reader0.ReadString("before");
-
- reader0.DetachNext();
- Inner = reader0.ReadObject<HandleInner>("inner");
-
- After = reader0.ReadString("after");
-
- var rawReader = (BinaryReader) reader.GetRawReader();
-
- RawBefore = rawReader.ReadString();
-
- reader0.DetachNext();
- RawInner = rawReader.ReadObject<HandleInner>();
-
- RawAfter = rawReader.ReadString();
- }
- }
-
- public class PropertyType
- {
- public int Field1;
-
- public int Field2
- {
- get;
- set;
- }
- }
-
- public enum TestEnum
- {
- Val1, Val2, Val3 = 10
- }
-
- public class DecimalReflective
- {
- /** */
- public decimal? Val;
-
- /** */
- public decimal?[] ValArr;
- }
-
- public class DecimalMarshalAware : DecimalReflective, IBinarizable
- {
- /** */
- public decimal? RawVal;
-
- /** */
- public decimal?[] RawValArr;
-
- /** <inheritDoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteDecimal("val", Val);
- writer.WriteDecimalArray("valArr", ValArr);
-
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteDecimal(RawVal);
- rawWriter.WriteDecimalArray(RawValArr);
- }
-
- /** <inheritDoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- Val = reader.ReadDecimal("val");
- ValArr = reader.ReadDecimalArray("valArr");
-
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- RawVal = rawReader.ReadDecimal();
- RawValArr = rawReader.ReadDecimalArray();
- }
- }
-
- /// <summary>
- /// Date time type.
- /// </summary>
- public class DateTimeType : IBinarizable
- {
- public DateTime Utc;
-
- public DateTime? UtcNull;
-
- public DateTime?[] UtcArr;
-
- public DateTime UtcRaw;
-
- public DateTime? UtcNullRaw;
-
- public DateTime?[] UtcArrRaw;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="now">Current local time.</param>
- public DateTimeType(DateTime now)
- {
- Utc = now.ToUniversalTime();
-
- UtcNull = Utc;
-
- UtcArr = new DateTime?[] { Utc };
-
- UtcRaw = Utc;
-
- UtcNullRaw = UtcNull;
-
- UtcArrRaw = new[] { UtcArr[0] };
- }
-
- /** <inheritDoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteTimestamp("utc", Utc);
- writer.WriteTimestamp("utcNull", UtcNull);
- writer.WriteTimestampArray("utcArr", UtcArr);
-
- IBinaryRawWriter rawWriter = writer.GetRawWriter();
-
- rawWriter.WriteTimestamp(UtcRaw);
- rawWriter.WriteTimestamp(UtcNullRaw);
- rawWriter.WriteTimestampArray(UtcArrRaw);
- }
-
- /** <inheritDoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- Utc = reader.ReadTimestamp("utc").Value;
- UtcNull = reader.ReadTimestamp("utc").Value;
- UtcArr = reader.ReadTimestampArray("utcArr");
-
- IBinaryRawReader rawReader = reader.GetRawReader();
-
- UtcRaw = rawReader.ReadTimestamp().Value;
- UtcNullRaw = rawReader.ReadTimestamp().Value;
- UtcArrRaw = rawReader.ReadTimestampArray();
- }
- }
-
- [Serializable]
- private class SerializableObject
- {
- public int Foo { get; set; }
-
- private bool Equals(SerializableObject other)
- {
- return Foo == other.Foo;
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != GetType()) return false;
-
- return Equals((SerializableObject) obj);
- }
-
- public override int GetHashCode()
- {
- return Foo;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs
deleted file mode 100644
index 32b659e..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableStructureTest.cs
+++ /dev/null
@@ -1,250 +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.
- */
-
-namespace Apache.Ignite.Core.Tests.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Impl.Binary;
- using NUnit.Framework;
-
- /// <summary>
- /// Contains tests for portable type structure.
- /// </summary>
- [TestFixture]
- public class PortableStructureTest
- {
- /** Repeat count. */
- public static readonly int RepeatCnt = 10;
-
- /** Objects per mode. */
- public static readonly int ObjectsPerMode = 5;
-
- /// <summary>
- /// Test object write with different structures.
- /// </summary>
- [Test]
- public void TestStructure()
- {
- for (int i = 1; i <= RepeatCnt; i++)
- {
- Console.WriteLine(">>> Iteration started: " + i);
-
- // 1. Generate and shuffle objects.
- IList<BranchedType> objs = new List<BranchedType>();
-
- for (int j = 0; j < 6 * ObjectsPerMode; j++)
- objs.Add(new BranchedType((j%6) + 1));
-
- objs = IgniteUtils.Shuffle(objs);
-
- // 2. Create new marshaller.
- BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(BranchedType));
-
- BinaryConfiguration cfg = new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg }
- };
-
- Marshaller marsh = new Marshaller(cfg);
-
- // 3. Marshal all data and ensure deserialized object is fine.
- foreach (BranchedType obj in objs)
- {
- Console.WriteLine(">>> Write object [mode=" + obj.mode + ']');
-
- byte[] data = marsh.Marshal(obj);
-
- BranchedType other = marsh.Unmarshal<BranchedType>(data);
-
- Assert.IsTrue(obj.Equals(other));
- }
-
- Console.WriteLine();
-
- // 4. Ensure that all fields are recorded.
- var desc = marsh.GetDescriptor(typeof (BranchedType));
-
- CollectionAssert.AreEquivalent(new[] {"mode", "f2", "f3", "f4", "f5", "f6", "f7", "f8"},
- desc.WriterTypeStructure.FieldTypes.Keys);
- }
- }
- }
-
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- public class BranchedType : IBinarizable
- {
- public int mode;
- public int f2;
- public int f3;
- public int f4;
- public int f5;
- public int f6;
- public int f7;
- public int f8;
-
- public BranchedType(int mode)
- {
- this.mode = mode;
-
- switch (mode)
- {
- case 1:
- f2 = 2;
-
- break;
-
- case 2:
- f2 = 2;
- f3 = 3;
- f4 = 4;
-
- break;
-
- case 3:
- f2 = 2;
- f3 = 3;
- f5 = 5;
-
- break;
-
- case 4:
- f2 = 2;
- f3 = 3;
- f5 = 5;
- f6 = 6;
-
- break;
-
- case 5:
- f2 = 2;
- f3 = 3;
- f7 = 7;
-
- break;
-
- case 6:
- f8 = 8;
-
- break;
- }
- }
-
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.WriteInt("mode", mode);
-
- switch (mode)
- {
- case 1:
- writer.WriteInt("f2", f2);
-
- break;
-
- case 2:
- writer.WriteInt("f2", f2);
- writer.WriteInt("f3", f3);
- writer.WriteInt("f4", f4);
-
- break;
-
- case 3:
- writer.WriteInt("f2", f2);
- writer.WriteInt("f3", f3);
- writer.WriteInt("f5", f5);
-
- break;
-
- case 4:
- writer.WriteInt("f2", f2);
- writer.WriteInt("f3", f3);
- writer.WriteInt("f5", f5);
- writer.WriteInt("f6", f6);
-
- break;
-
- case 5:
- writer.WriteInt("f2", f2);
- writer.WriteInt("f3", f3);
- writer.WriteInt("f7", f7);
-
- break;
-
- case 6:
- writer.WriteInt("f8", f8);
-
- break;
- }
- }
-
- public void ReadBinary(IBinaryReader reader)
- {
- mode = reader.ReadInt("mode");
-
- switch (mode)
- {
- case 1:
- f2 = reader.ReadInt("f2");
-
- break;
-
- case 2:
- f2 = reader.ReadInt("f2");
- f3 = reader.ReadInt("f3");
- f4 = reader.ReadInt("f4");
-
- break;
-
- case 3:
- f2 = reader.ReadInt("f2");
- f3 = reader.ReadInt("f3");
- f5 = reader.ReadInt("f5");
-
- break;
-
- case 4:
- f2 = reader.ReadInt("f2");
- f3 = reader.ReadInt("f3");
- f5 = reader.ReadInt("f5");
- f6 = reader.ReadInt("f6");
-
- break;
-
- case 5:
- f2 = reader.ReadInt("f2");
- f3 = reader.ReadInt("f3");
- f7 = reader.ReadInt("f7");
-
- break;
-
- case 6:
- f8 = reader.ReadInt("f8");
-
- break;
- }
- }
-
- public bool Equals(BranchedType other)
- {
- return mode == other.mode && f2 == other.f2 && f3 == other.f3 && f4 == other.f4 && f5 == other.f5 &&
- f6 == other.f6 && f7 == other.f7 && f8 == other.f8;
- }
- }
-}
[42/50] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
new file mode 100644
index 0000000..102afd1
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -0,0 +1,2157 @@
+/*
+ * 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.
+ */
+
+// ReSharper disable NonReadonlyMemberInGetHashCode
+// ReSharper disable CompareOfFloatsByEqualityOperator
+// ReSharper disable PossibleInvalidOperationException
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+// ReSharper disable MemberCanBePrivate.Global
+namespace Apache.Ignite.Core.Tests.Binary
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Binary.IO;
+ using NUnit.Framework;
+
+ /// <summary>
+ ///
+ /// </summary>
+ [TestFixture]
+ public class BinarySelfTest {
+ /** */
+ private Marshaller _marsh;
+
+ /// <summary>
+ ///
+ /// </summary>
+ [TestFixtureSetUp]
+ public void BeforeTest()
+ {
+ _marsh = new Marshaller(null);
+ }
+
+ /**
+ * <summary>Check write of primitive boolean.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveBool()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<bool>(_marsh.Marshal(false)), false);
+ Assert.AreEqual(_marsh.Unmarshal<bool>(_marsh.Marshal(true)), true);
+
+ Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal((bool?)false)), false);
+ Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal((bool?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive boolean array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveBoolArray()
+ {
+ bool[] vals = { true, false };
+
+ Assert.AreEqual(_marsh.Unmarshal<bool[]>(_marsh.Marshal(vals)), vals);
+
+ bool?[] vals2 = { true, false };
+
+ Assert.AreEqual(_marsh.Unmarshal<bool?[]>(_marsh.Marshal(vals2)), vals2);
+ }
+
+ /**
+ * <summary>Check write of primitive sbyte.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveSbyte()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal((sbyte)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal(sbyte.MinValue)), sbyte.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal(sbyte.MaxValue)), sbyte.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal((sbyte?)1)), (sbyte?)1);
+ Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal((sbyte?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive sbyte array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveSbyteArray()
+ {
+ sbyte[] vals = { sbyte.MinValue, 0, 1, sbyte.MaxValue };
+ sbyte[] newVals = _marsh.Unmarshal<sbyte[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive byte.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveByte()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal((byte)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal(byte.MinValue)), byte.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal(byte.MaxValue)), byte.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal((byte?)1)), (byte?)1);
+ Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal((byte?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive byte array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveByteArray()
+ {
+ byte[] vals = { byte.MinValue, 0, 1, byte.MaxValue };
+ byte[] newVals = _marsh.Unmarshal<byte[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive short.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveShort()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal((short)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal(short.MinValue)), short.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal(short.MaxValue)), short.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal((short?)1)), (short?)1);
+ Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal((short?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive short array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveShortArray()
+ {
+ short[] vals = { short.MinValue, 0, 1, short.MaxValue };
+ short[] newVals = _marsh.Unmarshal<short[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive ushort.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveUshort()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal((ushort)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal(ushort.MinValue)), ushort.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal(ushort.MaxValue)), ushort.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal((ushort?)1)), (ushort?)1);
+ Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal((ushort?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive short array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveUshortArray()
+ {
+ ushort[] vals = { ushort.MinValue, 0, 1, ushort.MaxValue };
+ ushort[] newVals = _marsh.Unmarshal<ushort[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive char.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveChar()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal((char)1)), (char)1);
+ Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal(char.MinValue)), char.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal(char.MaxValue)), char.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal((char?)1)), (char?)1);
+ Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal((char?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive uint array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveCharArray()
+ {
+ char[] vals = { char.MinValue, (char)0, (char)1, char.MaxValue };
+ char[] newVals = _marsh.Unmarshal<char[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive int.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveInt()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(int.MinValue)), int.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(int.MaxValue)), int.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal((int?)1)), (int?)1);
+ Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal((int?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive uint array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveIntArray()
+ {
+ int[] vals = { int.MinValue, 0, 1, int.MaxValue };
+ int[] newVals = _marsh.Unmarshal<int[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive uint.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveUint()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal((uint)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal(uint.MinValue)), uint.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal(uint.MaxValue)), uint.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal((uint?)1)), (int?)1);
+ Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal((uint?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive uint array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveUintArray()
+ {
+ uint[] vals = { uint.MinValue, 0, 1, uint.MaxValue };
+ uint[] newVals = _marsh.Unmarshal<uint[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive long.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveLong()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal((long)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal(long.MinValue)), long.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal(long.MaxValue)), long.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal((long?)1)), (long?)1);
+ Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal((long?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive long array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveLongArray()
+ {
+ long[] vals = { long.MinValue, 0, 1, long.MaxValue };
+ long[] newVals = _marsh.Unmarshal<long[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive ulong.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveUlong()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal((ulong)1)), 1);
+ Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal(ulong.MinValue)), ulong.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal(ulong.MaxValue)), ulong.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal((ulong?)1)), (ulong?)1);
+ Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal((ulong?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive ulong array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveUlongArray()
+ {
+ ulong[] vals = { ulong.MinValue, 0, 1, ulong.MaxValue };
+ ulong[] newVals = _marsh.Unmarshal<ulong[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive float.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveFloat()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal((float)1)), (float)1);
+ Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal(float.MinValue)), float.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal(float.MaxValue)), float.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal((float?)1)), (float?)1);
+ Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal((float?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive float array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveFloatArray()
+ {
+ float[] vals = { float.MinValue, 0, 1, float.MaxValue };
+ float[] newVals = _marsh.Unmarshal<float[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of primitive double.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveDouble()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal((double)1)), (double)1);
+ Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal(double.MinValue)), double.MinValue);
+ Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal(double.MaxValue)), double.MaxValue);
+
+ Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal((double?)1)), (double?)1);
+ Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal((double?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of primitive double array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveDoubleArray()
+ {
+ double[] vals = { double.MinValue, 0, 1, double.MaxValue };
+ double[] newVals = _marsh.Unmarshal<double[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of decimal.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveDecimal()
+ {
+ decimal val;
+
+ // Test positibe and negative.
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Zero)), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 0, 0, false, 0))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 0, 0, true, 0))), val);
+
+ // Test 32, 64 and 96 bits + mixed.
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 1, 0, false, 0))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 1, 0, true, 0))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 0, 1, false, 0))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(0, 0, 1, true, 0))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 1, 1, false, 0))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = new decimal(1, 1, 1, true, 0))), val);
+
+ // Test extremes.
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("65536"))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-65536"))), val);
+
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("4294967296"))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-4294967296"))), val);
+
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("281474976710656"))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-281474976710656"))), val);
+
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("18446744073709551616"))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-18446744073709551616"))), val);
+
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("1208925819614629174706176"))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-1208925819614629174706176"))), val);
+
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.MaxValue)), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.MinValue)), val);
+
+ // Test scale.
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("11,12"))), val);
+ Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-11,12"))), val);
+
+ // Test null.
+ Assert.AreEqual(_marsh.Unmarshal<decimal?>(_marsh.Marshal((decimal?)null)), null);
+ }
+
+ /**
+ * <summary>Check write of decimal array.</summary>
+ */
+ [Test]
+ public void TestWritePrimitiveDecimalArray()
+ {
+ decimal?[] vals = { decimal.One, decimal.Parse("11,12") };
+ var newVals = _marsh.Unmarshal<decimal?[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of string.</summary>
+ */
+ [Test]
+ public void TestWriteString()
+ {
+ Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal("str")), "str");
+ Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal((string) null)), null);
+ }
+
+ /**
+ * <summary>Check write of string array.</summary>
+ */
+ [Test]
+ public void TestWriteStringArray()
+ {
+ string[] vals = { "str1", null, "", "str2", null};
+ string[] newVals = _marsh.Unmarshal<string[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of Guid.</summary>
+ */
+ [Test]
+ public void TestWriteGuid()
+ {
+ Guid guid = Guid.NewGuid();
+ Guid? nGuid = guid;
+
+ Assert.AreEqual(_marsh.Unmarshal<Guid>(_marsh.Marshal(guid)), guid);
+ Assert.AreEqual(_marsh.Unmarshal<Guid?>(_marsh.Marshal(nGuid)), nGuid);
+
+ nGuid = null;
+
+ // ReSharper disable once ExpressionIsAlwaysNull
+ Assert.AreEqual(_marsh.Unmarshal<Guid?>(_marsh.Marshal(nGuid)), null);
+ }
+
+ /**
+ * <summary>Check write of string array.</summary>
+ */
+ [Test]
+ public void TestWriteGuidArray()
+ {
+ Guid?[] vals = { Guid.NewGuid(), null, Guid.Empty, Guid.NewGuid(), null };
+ Guid?[] newVals = _marsh.Unmarshal<Guid?[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /**
+ * <summary>Check write of enum.</summary>
+ */
+ [Test]
+ public void TestWriteEnum()
+ {
+ TestEnum val = TestEnum.Val1;
+
+ Assert.AreEqual(_marsh.Unmarshal<TestEnum>(_marsh.Marshal(val)), val);
+ }
+
+ /**
+ * <summary>Check write of enum.</summary>
+ */
+ [Test]
+ public void TestWriteEnumArray()
+ {
+ TestEnum[] vals = { TestEnum.Val2, TestEnum.Val3 };
+ TestEnum[] newVals = _marsh.Unmarshal<TestEnum[]>(_marsh.Marshal(vals));
+
+ Assert.AreEqual(vals, newVals);
+ }
+
+ /// <summary>
+ /// Test object with dates.
+ /// </summary>
+ [Test]
+ public void TestDateObject()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(DateTimeType)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ DateTime now = DateTime.Now;
+
+ DateTimeType obj = new DateTimeType(now);
+
+ DateTimeType otherObj = marsh.Unmarshal<DateTimeType>(marsh.Marshal(obj));
+
+ Assert.AreEqual(obj.Utc, otherObj.Utc);
+ Assert.AreEqual(obj.UtcNull, otherObj.UtcNull);
+ Assert.AreEqual(obj.UtcArr, otherObj.UtcArr);
+
+ Assert.AreEqual(obj.UtcRaw, otherObj.UtcRaw);
+ Assert.AreEqual(obj.UtcNullRaw, otherObj.UtcNullRaw);
+ Assert.AreEqual(obj.UtcArrRaw, otherObj.UtcArrRaw);
+ }
+
+ /// <summary>
+ /// Tests the DateTime marshalling.
+ /// </summary>
+ [Test]
+ public void TestDateTime()
+ {
+ var time = DateTime.Now;
+ Assert.AreEqual(_marsh.Unmarshal<DateTime>(_marsh.Marshal(time)), time);
+
+ var timeUtc = DateTime.UtcNow;
+ Assert.AreEqual(_marsh.Unmarshal<DateTime>(_marsh.Marshal(timeUtc)), timeUtc);
+
+ // Check exception with non-UTC date
+ var stream = new BinaryHeapStream(128);
+ var writer = _marsh.StartMarshal(stream);
+ Assert.Throws<InvalidOperationException>(() => writer.WriteTimestamp(DateTime.Now));
+ }
+
+ /**
+ * <summary>Check generic collections.</summary>
+ */
+ [Test]
+ public void TestGenericCollections()
+ {
+ var list = new List<string> {"1"};
+
+ var data = _marsh.Marshal(list);
+
+ var newObjList = _marsh.Unmarshal<IList<string>>(data);
+
+ CollectionAssert.AreEquivalent(list, newObjList);
+ }
+
+ /// <summary>
+ /// Tests marshal aware type with generic collections.
+ /// </summary>
+ [Test]
+ public void TestGenericCollectionsType()
+ {
+ var marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (PrimitiveFieldType)),
+ new BinaryTypeConfiguration(typeof (GenericCollectionsType<PrimitiveFieldType, SerializableObject>))
+ }
+ });
+
+ var obj = new GenericCollectionsType<PrimitiveFieldType, SerializableObject>
+ {
+ Keys = new[] {new PrimitiveFieldType(), new PrimitiveFieldType()},
+ Values =
+ new List<SerializableObject>
+ {
+ new SerializableObject {Foo = 1},
+ new SerializableObject {Foo = 5}
+ },
+ Pairs = new Dictionary<PrimitiveFieldType, SerializableObject>
+ {
+ {new PrimitiveFieldType(), new SerializableObject {Foo = 10}},
+ {new PrimitiveFieldType {PByte = 10}, new SerializableObject {Foo = 20}}
+ },
+ Objects = new object[] {1, 2, "3", 4.4}
+ };
+
+ var data = marsh.Marshal(obj);
+
+ var result = marsh.Unmarshal<GenericCollectionsType<PrimitiveFieldType, SerializableObject>>(data);
+
+ CollectionAssert.AreEquivalent(obj.Keys, result.Keys);
+ CollectionAssert.AreEquivalent(obj.Values, result.Values);
+ CollectionAssert.AreEquivalent(obj.Pairs, result.Pairs);
+ CollectionAssert.AreEquivalent(obj.Objects, result.Objects);
+ }
+
+ /**
+ * <summary>Check property read.</summary>
+ */
+ [Test]
+ public void TestProperty()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(PropertyType)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ PropertyType obj = new PropertyType
+ {
+ Field1 = 1,
+ Field2 = 2
+ };
+
+ byte[] data = marsh.Marshal(obj);
+
+ PropertyType newObj = marsh.Unmarshal<PropertyType>(data);
+
+ Assert.AreEqual(obj.Field1, newObj.Field1);
+ Assert.AreEqual(obj.Field2, newObj.Field2);
+
+ IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(obj.Field1, portNewObj.GetField<int>("field1"));
+ Assert.AreEqual(obj.Field2, portNewObj.GetField<int>("Field2"));
+ }
+
+ /**
+ * <summary>Check write of primitive fields through reflection.</summary>
+ */
+ [Test]
+ public void TestPrimitiveFieldsReflective()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldType)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ PrimitiveFieldType obj = new PrimitiveFieldType();
+
+ CheckPrimitiveFields(marsh, obj);
+ }
+
+ /**
+ * <summary>Check write of primitive fields through binary interface.</summary>
+ */
+ [Test]
+ public void TestPrimitiveFieldsBinary()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldBinaryType)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = typeCfgs;
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ PrimitiveFieldBinaryType obj = new PrimitiveFieldBinaryType();
+
+ CheckPrimitiveFields(marsh, obj);
+ }
+
+ /**
+ * <summary>Check write of primitive fields through binary interface.</summary>
+ */
+ [Test]
+ public void TestPrimitiveFieldsRawBinary()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldRawBinaryType)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = typeCfgs;
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ PrimitiveFieldRawBinaryType obj = new PrimitiveFieldRawBinaryType();
+
+ CheckPrimitiveFields(marsh, obj);
+ }
+
+ /**
+ * <summary>Check write of primitive fields through binary interface.</summary>
+ */
+ [Test]
+ public void TestPrimitiveFieldsSerializer()
+ {
+ var typeCfgs = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (PrimitiveFieldType))
+ {
+ Serializer = new PrimitiveFieldsSerializer()
+ }
+ };
+
+ BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ PrimitiveFieldType obj = new PrimitiveFieldType();
+
+ CheckPrimitiveFields(marsh, obj);
+ }
+
+ /**
+ * <summary>Check decimals.</summary>
+ */
+ [Test]
+ public void TestDecimalFields()
+ {
+ BinaryConfiguration cfg = new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (DecimalReflective)),
+ new BinaryTypeConfiguration(typeof (DecimalMarshalAware))
+ }
+ };
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ // 1. Test reflective stuff.
+ DecimalReflective obj1 = new DecimalReflective
+ {
+ Val = decimal.Zero,
+ ValArr = new decimal?[] {decimal.One, decimal.MinusOne}
+ };
+
+ IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(marsh.Marshal(obj1), BinaryMode.ForceBinary);
+
+ Assert.AreEqual(obj1.Val, portObj.GetField<decimal>("val"));
+ Assert.AreEqual(obj1.ValArr, portObj.GetField<decimal?[]>("valArr"));
+
+ Assert.AreEqual(obj1.Val, portObj.Deserialize<DecimalReflective>().Val);
+ Assert.AreEqual(obj1.ValArr, portObj.Deserialize<DecimalReflective>().ValArr);
+
+ // 2. Test marshal aware stuff.
+ DecimalMarshalAware obj2 = new DecimalMarshalAware();
+
+ obj2.Val = decimal.Zero;
+ obj2.ValArr = new decimal?[] { decimal.One, decimal.MinusOne };
+ obj2.RawVal = decimal.MaxValue;
+ obj2.RawValArr = new decimal?[] { decimal.MinusOne, decimal.One} ;
+
+ portObj = marsh.Unmarshal<IBinaryObject>(marsh.Marshal(obj2), BinaryMode.ForceBinary);
+
+ Assert.AreEqual(obj2.Val, portObj.GetField<decimal>("val"));
+ Assert.AreEqual(obj2.ValArr, portObj.GetField<decimal?[]>("valArr"));
+
+ Assert.AreEqual(obj2.Val, portObj.Deserialize<DecimalMarshalAware>().Val);
+ Assert.AreEqual(obj2.ValArr, portObj.Deserialize<DecimalMarshalAware>().ValArr);
+ Assert.AreEqual(obj2.RawVal, portObj.Deserialize<DecimalMarshalAware>().RawVal);
+ Assert.AreEqual(obj2.RawValArr, portObj.Deserialize<DecimalMarshalAware>().RawValArr);
+ }
+
+ /**
+ * <summary>Check write of primitive fields through raw serializer.</summary>
+ */
+ [Test]
+ public void TestPrimitiveFieldsRawSerializer()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ BinaryTypeConfiguration typeCfg =
+ new BinaryTypeConfiguration(typeof(PrimitiveFieldType));
+
+ typeCfg.Serializer = new PrimitiveFieldsRawSerializer();
+
+ typeCfgs.Add(typeCfg);
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = typeCfgs;
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ PrimitiveFieldType obj = new PrimitiveFieldType();
+
+ CheckPrimitiveFields(marsh, obj);
+ }
+
+ private void CheckPrimitiveFields(Marshaller marsh, PrimitiveFieldType obj)
+ {
+ obj.PBool = true;
+ obj.PByte = 2;
+ obj.PSbyte = 3;
+ obj.PShort = 4;
+ obj.PUshort = 5;
+ obj.PInt = 6;
+ obj.PUint = 7;
+ obj.PLong = 8;
+ obj.PUlong = 9;
+ obj.PChar = 'a';
+ obj.PFloat = 10;
+ obj.PDouble = 11;
+ obj.PString = "abc";
+ obj.PGuid = Guid.NewGuid();
+ obj.PnGuid = Guid.NewGuid();
+ obj.IgniteGuid = new IgniteGuid(Guid.NewGuid(), 123);
+
+ CheckPrimitiveFieldsSerialization(marsh, obj);
+ }
+
+ private void CheckPrimitiveFieldsSerialization(Marshaller marsh, PrimitiveFieldType obj)
+ {
+ byte[] bytes = marsh.Marshal(obj);
+
+ IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
+
+ PrimitiveFieldType newObj = portObj.Deserialize<PrimitiveFieldType>();
+
+ Assert.AreEqual(obj, newObj);
+ }
+
+ /**
+ * <summary>Check write of object with enums.</summary>
+ */
+ [Test]
+ public void TestEnumsReflective()
+ {
+ Marshaller marsh =
+ new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations =
+ new List<BinaryTypeConfiguration> {new BinaryTypeConfiguration(typeof (EnumType))}
+ });
+
+ EnumType obj = new EnumType
+ {
+ PEnum = TestEnum.Val1,
+ PEnumArray = new[] {TestEnum.Val2, TestEnum.Val3}
+ };
+
+ byte[] bytes = marsh.Marshal(obj);
+
+ IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
+
+ EnumType newObj = portObj.Deserialize<EnumType>();
+
+ Assert.AreEqual(obj.PEnum, newObj.PEnum);
+ Assert.AreEqual(obj.PEnumArray, newObj.PEnumArray);
+ }
+
+ /**
+ * <summary>Check write of object with collections.</summary>
+ */
+ [Test]
+ public void TestCollectionsReflective()
+ {
+ var marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (CollectionsType)),
+ new BinaryTypeConfiguration(typeof (InnerObjectType))
+ }
+ });
+
+ var obj = new CollectionsType
+ {
+ Hashtable = new Hashtable {{1, 2}, {3, 4}},
+ LinkedList = new LinkedList<int>(new[] {1, 2, 3}),
+ SortedDict = new SortedDictionary<string, int> {{"1", 2}},
+ Dict = new Dictionary<int, string> {{1, "2"}},
+ Arr = new[] {new InnerObjectType()}
+ };
+
+ var list = new ArrayList
+ {
+ true,
+ (byte) 1,
+ (short) 2,
+ 'a',
+ 3,
+ (long) 4,
+ (float) 5,
+ (double) 6,
+ "string",
+ Guid.NewGuid(),
+ new InnerObjectType
+ {
+ PInt1 = 1,
+ PInt2 = 2
+ }
+ };
+
+ obj.Col1 = list;
+
+ byte[] bytes = marsh.Marshal(obj);
+
+ IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
+
+ CollectionsType newObj = portObj.Deserialize<CollectionsType>();
+
+ Assert.AreEqual(obj, newObj);
+
+ obj.Col1 = null;
+
+ Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
+
+ obj.Col1 = list;
+ obj.Col2 = list;
+
+ Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
+
+ obj.Col2 = new TestList();
+
+ Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
+ }
+
+ /**
+ * <summary>Check write of object fields through reflective serializer.</summary>
+ */
+ [Test]
+ public void TestObjectReflective()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(OuterObjectType)));
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(InnerObjectType)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = typeCfgs;
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ CheckObject(marsh, new OuterObjectType(), new InnerObjectType());
+ }
+
+ /**
+ * <summary>Test handles.</summary>
+ */
+ [Test]
+ public void TestHandles()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(HandleInner)));
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(HandleOuter)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = typeCfgs;
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ HandleOuter outer = new HandleOuter();
+
+ outer.Before = "outBefore";
+ outer.After = "outAfter";
+ outer.RawBefore = "outRawBefore";
+ outer.RawAfter = "outRawAfter";
+
+ HandleInner inner = new HandleInner();
+
+ inner.Before = "inBefore";
+ inner.After = "inAfter";
+ inner.RawBefore = "inRawBefore";
+ inner.RawAfter = "inRawAfter";
+
+ outer.Inner = inner;
+ outer.RawInner = inner;
+
+ inner.Outer = outer;
+ inner.RawOuter = outer;
+
+ byte[] bytes = marsh.Marshal(outer);
+
+ IBinaryObject outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ HandleOuter newOuter = outerObj.Deserialize<HandleOuter>();
+ HandleInner newInner = newOuter.Inner;
+
+ CheckHandlesConsistency(outer, inner, newOuter, newInner);
+
+ // Get inner object by field.
+ IBinaryObject innerObj = outerObj.GetField<IBinaryObject>("inner");
+
+ newInner = innerObj.Deserialize<HandleInner>();
+ newOuter = newInner.Outer;
+
+ CheckHandlesConsistency(outer, inner, newOuter, newInner);
+
+ // Get outer object from inner object by handle.
+ outerObj = innerObj.GetField<IBinaryObject>("outer");
+
+ newOuter = outerObj.Deserialize<HandleOuter>();
+ newInner = newOuter.Inner;
+
+ CheckHandlesConsistency(outer, inner, newOuter, newInner);
+ }
+
+ /**
+ * <summary>Test handles with exclusive writes.</summary>
+ */
+ [Test]
+ public void TestHandlesExclusive([Values(true, false)] bool detached, [Values(true, false)] bool asbinary)
+ {
+ var marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (HandleInner)),
+ new BinaryTypeConfiguration(typeof (HandleOuterExclusive))
+ }
+ });
+
+ var inner = new HandleInner
+ {
+ Before = "inBefore",
+ After = "inAfter",
+ RawBefore = "inRawBefore",
+ RawAfter = "inRawAfter"
+ };
+
+ var outer = new HandleOuterExclusive
+ {
+ Before = "outBefore",
+ After = "outAfter",
+ RawBefore = "outRawBefore",
+ RawAfter = "outRawAfter",
+ Inner = inner,
+ RawInner = inner
+ };
+
+ inner.Outer = outer;
+ inner.RawOuter = outer;
+
+ var bytes = asbinary
+ ? marsh.Marshal(new IgniteBinary(marsh).ToBinary<IBinaryObject>(outer))
+ : marsh.Marshal(outer);
+
+ IBinaryObject outerObj;
+
+ if (detached)
+ {
+ var reader = new BinaryReader(marsh, new Dictionary<long, IBinaryTypeDescriptor>(),
+ new BinaryHeapStream(bytes), BinaryMode.ForceBinary, null);
+
+ reader.DetachNext();
+
+ outerObj = reader.Deserialize<IBinaryObject>();
+ }
+ else
+ outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ HandleOuter newOuter = outerObj.Deserialize<HandleOuter>();
+
+ Assert.IsFalse(newOuter == newOuter.Inner.Outer);
+ Assert.IsFalse(newOuter == newOuter.Inner.RawOuter);
+ Assert.IsFalse(newOuter == newOuter.RawInner.RawOuter);
+ Assert.IsFalse(newOuter == newOuter.RawInner.RawOuter);
+
+ Assert.IsFalse(newOuter.Inner == newOuter.RawInner);
+
+ Assert.IsTrue(newOuter.Inner.Outer == newOuter.Inner.RawOuter);
+ Assert.IsTrue(newOuter.RawInner.Outer == newOuter.RawInner.RawOuter);
+
+ Assert.IsTrue(newOuter.Inner == newOuter.Inner.Outer.Inner);
+ Assert.IsTrue(newOuter.Inner == newOuter.Inner.Outer.RawInner);
+ Assert.IsTrue(newOuter.RawInner == newOuter.RawInner.Outer.Inner);
+ Assert.IsTrue(newOuter.RawInner == newOuter.RawInner.Outer.RawInner);
+ }
+
+ ///
+ /// <summary>Test KeepSerialized property</summary>
+ ///
+ [Test]
+ public void TestKeepSerializedDefault()
+ {
+ CheckKeepSerialized(new BinaryConfiguration(), true);
+ }
+
+ ///
+ /// <summary>Test KeepSerialized property</summary>
+ ///
+ [Test]
+ public void TestKeepSerializedDefaultFalse()
+ {
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.DefaultKeepDeserialized = false;
+
+ CheckKeepSerialized(cfg, false);
+ }
+
+ ///
+ /// <summary>Test KeepSerialized property</summary>
+ ///
+ [Test]
+ public void TestKeepSerializedTypeCfgFalse()
+ {
+ BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(PropertyType));
+
+ typeCfg.KeepDeserialized = false;
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg };
+
+ CheckKeepSerialized(cfg, false);
+ }
+
+ ///
+ /// <summary>Test KeepSerialized property</summary>
+ ///
+ [Test]
+ public void TestKeepSerializedTypeCfgTrue()
+ {
+ BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(PropertyType));
+ typeCfg.KeepDeserialized = true;
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+ cfg.DefaultKeepDeserialized = false;
+
+ cfg.TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg };
+
+ CheckKeepSerialized(cfg, true);
+ }
+
+ /// <summary>
+ /// Test correct serialization/deserialization of arrays of special types.
+ /// </summary>
+ [Test]
+ public void TestSpecialArrays()
+ {
+ ICollection<BinaryTypeConfiguration> typeCfgs =
+ new List<BinaryTypeConfiguration>();
+
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(SpecialArray)));
+ typeCfgs.Add(new BinaryTypeConfiguration(typeof(SpecialArrayMarshalAware)));
+
+ BinaryConfiguration cfg = new BinaryConfiguration();
+
+ cfg.TypeConfigurations = typeCfgs;
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ Guid[] guidArr = { Guid.NewGuid() };
+ Guid?[] nGuidArr = { Guid.NewGuid() };
+ DateTime[] dateArr = { DateTime.Now.ToUniversalTime() };
+ DateTime?[] nDateArr = { DateTime.Now.ToUniversalTime() };
+
+ // Use special object.
+ SpecialArray obj1 = new SpecialArray
+ {
+ GuidArr = guidArr,
+ NGuidArr = nGuidArr,
+ DateArr = dateArr,
+ NDateArr = nDateArr
+ };
+
+ byte[] bytes = marsh.Marshal(obj1);
+
+ IBinaryObject portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.IsNotNull(portObj.Deserialize<SpecialArray>());
+
+ Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("guidArr"));
+ Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("nGuidArr"));
+ Assert.AreEqual(dateArr, portObj.GetField<DateTime[]>("dateArr"));
+ Assert.AreEqual(nDateArr, portObj.GetField<DateTime?[]>("nDateArr"));
+
+ obj1 = portObj.Deserialize<SpecialArray>();
+
+ Assert.AreEqual(guidArr, obj1.GuidArr);
+ Assert.AreEqual(nGuidArr, obj1.NGuidArr);
+ Assert.AreEqual(dateArr, obj1.DateArr);
+ Assert.AreEqual(nDateArr, obj1.NDateArr);
+
+ // Use special with IGridbinaryMarshalAware.
+ SpecialArrayMarshalAware obj2 = new SpecialArrayMarshalAware();
+
+ obj2.GuidArr = guidArr;
+ obj2.NGuidArr = nGuidArr;
+ obj2.DateArr = dateArr;
+ obj2.NDateArr = nDateArr;
+
+ bytes = marsh.Marshal(obj2);
+
+ portObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("a"));
+ Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("b"));
+ Assert.AreEqual(dateArr, portObj.GetField<DateTime[]>("c"));
+ Assert.AreEqual(nDateArr, portObj.GetField<DateTime?[]>("d"));
+
+ obj2 = portObj.Deserialize<SpecialArrayMarshalAware>();
+
+ Assert.AreEqual(guidArr, obj2.GuidArr);
+ Assert.AreEqual(nGuidArr, obj2.NGuidArr);
+ Assert.AreEqual(dateArr, obj2.DateArr);
+ Assert.AreEqual(nDateArr, obj2.NDateArr);
+ }
+
+ /// <summary>
+ /// Writes objects of various sizes to test schema compaction
+ /// (where field offsets can be stored as 1, 2 or 4 bytes).
+ /// </summary>
+ [Test]
+ public void TestCompactSchema()
+ {
+ var marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof (SpecialArray)),
+ new BinaryTypeConfiguration(typeof (SpecialArrayMarshalAware))
+ }
+ });
+
+ var dt = new SpecialArrayMarshalAware();
+
+ foreach (var i in new[] {1, 5, 10, 13, 14, 15, 100, 200, 1000, 5000, 15000, 30000})
+ {
+ dt.NGuidArr = Enumerable.Range(1, i).Select(x => (Guid?) Guid.NewGuid()).ToArray();
+ dt.NDateArr = Enumerable.Range(1, i).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray();
+
+ var bytes = marsh.Marshal(dt);
+
+ var res = marsh.Unmarshal<SpecialArrayMarshalAware>(bytes);
+
+ CollectionAssert.AreEquivalent(dt.NGuidArr, res.NGuidArr);
+ CollectionAssert.AreEquivalent(dt.NDateArr, res.NDateArr);
+ }
+ }
+
+ private static void CheckKeepSerialized(BinaryConfiguration cfg, bool expKeep)
+ {
+ if (cfg.TypeConfigurations == null)
+ {
+ cfg.TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof(PropertyType))
+ };
+ }
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ byte[] data = marsh.Marshal(new PropertyType());
+
+ IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
+
+ PropertyType deserialized1 = portNewObj.Deserialize<PropertyType>();
+ PropertyType deserialized2 = portNewObj.Deserialize<PropertyType>();
+
+ Assert.NotNull(deserialized1);
+
+ Assert.AreEqual(expKeep, deserialized1 == deserialized2);
+ }
+
+ private void CheckHandlesConsistency(HandleOuter outer, HandleInner inner, HandleOuter newOuter,
+ HandleInner newInner)
+ {
+ Assert.True(newOuter != null);
+ Assert.AreEqual(outer.Before, newOuter.Before);
+ Assert.True(newOuter.Inner == newInner);
+ Assert.AreEqual(outer.After, newOuter.After);
+ Assert.AreEqual(outer.RawBefore, newOuter.RawBefore);
+ Assert.True(newOuter.RawInner == newInner);
+ Assert.AreEqual(outer.RawAfter, newOuter.RawAfter);
+
+ Assert.True(newInner != null);
+ Assert.AreEqual(inner.Before, newInner.Before);
+ Assert.True(newInner.Outer == newOuter);
+ Assert.AreEqual(inner.After, newInner.After);
+ Assert.AreEqual(inner.RawBefore, newInner.RawBefore);
+ Assert.True(newInner.RawOuter == newOuter);
+ Assert.AreEqual(inner.RawAfter, newInner.RawAfter);
+ }
+
+ private static void CheckObject(Marshaller marsh, OuterObjectType outObj, InnerObjectType inObj)
+ {
+ inObj.PInt1 = 1;
+ inObj.PInt2 = 2;
+
+ outObj.InObj = inObj;
+
+ byte[] bytes = marsh.Marshal(outObj);
+
+ IBinaryObject portOutObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(outObj.GetHashCode(), portOutObj.GetHashCode());
+
+ OuterObjectType newOutObj = portOutObj.Deserialize<OuterObjectType>();
+
+ Assert.AreEqual(outObj, newOutObj);
+ }
+
+ public class OuterObjectType
+ {
+ public InnerObjectType InObj { get; set; }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ if (this == obj)
+ return true;
+
+ var type = obj as OuterObjectType;
+
+ return type != null && Equals(InObj, type.InObj);
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return InObj != null ? InObj.GetHashCode() : 0;
+ }
+ }
+
+ [Serializable]
+ public class InnerObjectType
+ {
+ public int PInt1 { get; set; }
+
+ public int PInt2 { get; set; }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ if (this == obj)
+ return true;
+
+ var that = obj as InnerObjectType;
+
+ return that != null && (PInt1 == that.PInt1 && PInt2 == that.PInt2);
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return 31 * PInt1 + PInt2;
+ }
+
+ /** <inheritdoc /> */
+ public override string ToString()
+ {
+ return "InnerObjectType[pInt1=" + PInt1 + ", pInt2=" + PInt2 + ']';
+ }
+ }
+
+ public class CollectionsType
+ {
+ public ICollection Col1 { get; set; }
+
+ public ArrayList Col2 { get; set; }
+
+ public Hashtable Hashtable { get; set; }
+
+ public Dictionary<int, string> Dict { get; set; }
+
+ public InnerObjectType[] Arr { get; set; }
+
+ public SortedDictionary<string, int> SortedDict { get; set; }
+
+ public LinkedList<int> LinkedList { get; set; }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ if (this == obj)
+ return true;
+
+ var that = obj as CollectionsType;
+
+ return that != null
+ && CompareCollections(Col1, that.Col1)
+ && CompareCollections(Col2, that.Col2)
+ && CompareCollections(Hashtable, that.Hashtable)
+ && CompareCollections(Dict, that.Dict)
+ && CompareCollections(Arr, that.Arr)
+ && CompareCollections(SortedDict, that.SortedDict)
+ && CompareCollections(LinkedList, that.LinkedList);
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ int res = 0;
+
+ foreach (var col in new object[] {Col1, Col2, Hashtable, Dict, Arr, SortedDict, LinkedList})
+ res = 31*res + (col != null ? col.GetHashCode() : 0);
+
+ return res;
+ }
+ }
+
+ public class GenericCollectionsType<TKey, TValue> : IBinarizable
+ {
+ public ICollection<TKey> Keys { get; set; }
+
+ public ICollection<TValue> Values { get; set; }
+
+ public IDictionary<TKey, TValue> Pairs { get; set; }
+
+ public ICollection<object> Objects { get; set; }
+
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteObject("Keys", Keys);
+ writer.WriteObject("Values", Values);
+ writer.WriteObject("Pairs", Pairs);
+ writer.WriteObject("Objects", Objects);
+ }
+
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Keys = (ICollection<TKey>) reader.ReadObject<object>("Keys");
+ Values = (ICollection<TValue>) reader.ReadObject<object>("Values");
+ Pairs = (IDictionary<TKey, TValue>) reader.ReadObject<object>("Pairs");
+ Objects = (ICollection<object>) reader.ReadObject<object>("Objects");
+ }
+ }
+
+ public class TestList : ArrayList
+ {
+
+ }
+
+ private static bool CompareCollections(ICollection col1, ICollection col2)
+ {
+ if (col1 == null && col2 == null)
+ return true;
+ if (col1 == null || col2 == null)
+ return false;
+
+ return col1.OfType<object>().SequenceEqual(col2.OfType<object>());
+ }
+
+ public class PrimitiveArrayFieldType
+ {
+ public bool[] PBool { get; set; }
+
+ public sbyte[] PSbyte { get; set; }
+
+ public byte[] PByte { get; set; }
+
+ public short[] PShort { get; set; }
+
+ public ushort[] PUshort { get; set; }
+
+ public char[] PChar { get; set; }
+
+ public int[] PInt { get; set; }
+
+ public uint[] PUint { get; set; }
+
+ public long[] PLong { get; set; }
+
+ public ulong[] PUlong { get; set; }
+
+ public float[] PFloat { get; set; }
+
+ public double[] PDouble { get; set; }
+
+ public string[] PString { get; set; }
+
+ public Guid?[] PGuid { get; set; }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ if (this == obj)
+ return true;
+
+ var other = obj as PrimitiveArrayFieldType;
+
+ return other != null && (PBool == other.PBool &&
+ PByte == other.PByte &&
+ PSbyte == other.PSbyte &&
+ PShort == other.PShort &&
+ PUshort == other.PUshort &&
+ PInt == other.PInt &&
+ PUint == other.PUint &&
+ PLong == other.PLong &&
+ PUlong == other.PUlong &&
+ PChar == other.PChar &&
+ PFloat == other.PFloat &&
+ PDouble == other.PDouble &&
+ PString == other.PString &&
+ PGuid == other.PGuid);
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return PInt != null && PInt.Length > 0 ? PInt[0].GetHashCode() : 0;
+ }
+ }
+
+ public class SpecialArray
+ {
+ public Guid[] GuidArr;
+ public Guid?[] NGuidArr;
+ public DateTime[] DateArr;
+ public DateTime?[] NDateArr;
+ }
+
+ public class SpecialArrayMarshalAware : SpecialArray, IBinarizable
+ {
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteObject("a", GuidArr);
+ writer.WriteObject("b", NGuidArr);
+ writer.WriteObject("c", DateArr);
+ writer.WriteObject("d", NDateArr);
+ }
+
+ public void ReadBinary(IBinaryReader reader)
+ {
+ GuidArr = reader.ReadObject<Guid[]>("a");
+ NGuidArr = reader.ReadObject<Guid?[]>("b");
+ DateArr = reader.ReadObject<DateTime[]>("c");
+ NDateArr = reader.ReadObject<DateTime?[]>("d");
+ }
+ }
+
+ public class EnumType
+ {
+ public TestEnum PEnum { get; set; }
+
+ public TestEnum[] PEnumArray { get; set; }
+ }
+
+ [Serializable]
+ public class PrimitiveFieldType
+ {
+ public bool PBool { get; set; }
+
+ public sbyte PSbyte { get; set; }
+
+ public byte PByte { get; set; }
+
+ public short PShort { get; set; }
+
+ public ushort PUshort { get; set; }
+
+ public char PChar { get; set; }
+
+ public int PInt { get; set; }
+
+ public uint PUint { get; set; }
+
+ public long PLong { get; set; }
+
+ public ulong PUlong { get; set; }
+
+ public float PFloat { get; set; }
+
+ public double PDouble { get; set; }
+
+ public string PString { get; set; }
+
+ public Guid PGuid { get; set; }
+
+ public Guid? PnGuid { get; set; }
+
+ public IgniteGuid IgniteGuid { get; set; }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ if (this == obj)
+ return true;
+
+ if (obj != null && obj is PrimitiveFieldType)
+ {
+ PrimitiveFieldType that = (PrimitiveFieldType)obj;
+
+ return PBool == that.PBool &&
+ PByte == that.PByte &&
+ PSbyte == that.PSbyte &&
+ PShort == that.PShort &&
+ PUshort == that.PUshort &&
+ PInt == that.PInt &&
+ PUint == that.PUint &&
+ PLong == that.PLong &&
+ PUlong == that.PUlong &&
+ PChar == that.PChar &&
+ PFloat == that.PFloat &&
+ PDouble == that.PDouble &&
+ (string.Equals(PString, that.PString)) &&
+ PGuid.Equals(that.PGuid) &&
+ IgniteGuid.Equals(that.IgniteGuid) &&
+ (PnGuid == null && that.PnGuid == null || PnGuid != null && PnGuid.Equals(that.PnGuid));
+ }
+ return false;
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return PInt;
+ }
+ }
+
+ public class PrimitiveFieldBinaryType : PrimitiveFieldType, IBinarizable
+ {
+ public unsafe void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteBoolean("bool", PBool);
+ writer.WriteByte("byte", PByte);
+ writer.WriteShort("short", PShort);
+ writer.WriteInt("int", PInt);
+ writer.WriteLong("long", PLong);
+ writer.WriteChar("char", PChar);
+ writer.WriteFloat("float", PFloat);
+ writer.WriteDouble("double", PDouble);
+
+ sbyte sByte = PSbyte;
+ ushort uShort = PUshort;
+ uint uInt = PUint;
+ ulong uLong = PUlong;
+
+ writer.WriteByte("sbyte", *(byte*)&sByte);
+ writer.WriteShort("ushort", *(short*)&uShort);
+ writer.WriteInt("uint", *(int*)&uInt);
+ writer.WriteLong("ulong", *(long*)&uLong);
+
+ writer.WriteString("string", PString);
+ writer.WriteGuid("guid", PGuid);
+ writer.WriteGuid("nguid", PnGuid);
+
+ writer.WriteObject("iguid", IgniteGuid);
+ }
+
+ public unsafe void ReadBinary(IBinaryReader reader)
+ {
+ PBool = reader.ReadBoolean("bool");
+ PByte = reader.ReadByte("byte");
+ PShort = reader.ReadShort("short");
+ PInt = reader.ReadInt("int");
+
+ PLong = reader.ReadLong("long");
+ PChar = reader.ReadChar("char");
+ PFloat = reader.ReadFloat("float");
+ PDouble = reader.ReadDouble("double");
+
+ byte sByte = reader.ReadByte("sbyte");
+ short uShort = reader.ReadShort("ushort");
+ int uInt = reader.ReadInt("uint");
+ long uLong = reader.ReadLong("ulong");
+
+ PSbyte = *(sbyte*)&sByte;
+ PUshort = *(ushort*)&uShort;
+ PUint = *(uint*)&uInt;
+ PUlong = *(ulong*)&uLong;
+
+ PString = reader.ReadString("string");
+ PGuid = reader.ReadObject<Guid>("guid");
+ PnGuid = reader.ReadGuid("nguid");
+
+ IgniteGuid = reader.ReadObject<IgniteGuid>("iguid");
+ }
+ }
+
+ public class PrimitiveFieldRawBinaryType : PrimitiveFieldType, IBinarizable
+ {
+ public unsafe void WriteBinary(IBinaryWriter writer)
+ {
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteBoolean(PBool);
+ rawWriter.WriteByte(PByte);
+ rawWriter.WriteShort(PShort);
+ rawWriter.WriteInt(PInt);
+ rawWriter.WriteLong(PLong);
+ rawWriter.WriteChar(PChar);
+ rawWriter.WriteFloat(PFloat);
+ rawWriter.WriteDouble(PDouble);
+
+ sbyte sByte = PSbyte;
+ ushort uShort = PUshort;
+ uint uInt = PUint;
+ ulong uLong = PUlong;
+
+ rawWriter.WriteByte(*(byte*)&sByte);
+ rawWriter.WriteShort(*(short*)&uShort);
+ rawWriter.WriteInt(*(int*)&uInt);
+ rawWriter.WriteLong(*(long*)&uLong);
+
+ rawWriter.WriteString(PString);
+ rawWriter.WriteGuid(PGuid);
+ rawWriter.WriteGuid(PnGuid);
+
+ rawWriter.WriteObject(IgniteGuid);
+ }
+
+ public unsafe void ReadBinary(IBinaryReader reader)
+ {
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ PBool = rawReader.ReadBoolean();
+ PByte = rawReader.ReadByte();
+ PShort = rawReader.ReadShort();
+ PInt = rawReader.ReadInt();
+
+ PLong = rawReader.ReadLong();
+ PChar = rawReader.ReadChar();
+ PFloat = rawReader.ReadFloat();
+ PDouble = rawReader.ReadDouble();
+
+ byte sByte = rawReader.ReadByte();
+ short uShort = rawReader.ReadShort();
+ int uInt = rawReader.ReadInt();
+ long uLong = rawReader.ReadLong();
+
+ PSbyte = *(sbyte*)&sByte;
+ PUshort = *(ushort*)&uShort;
+ PUint = *(uint*)&uInt;
+ PUlong = *(ulong*)&uLong;
+
+ PString = rawReader.ReadString();
+ PGuid = rawReader.ReadGuid().Value;
+ PnGuid = rawReader.ReadGuid();
+
+ IgniteGuid = rawReader.ReadObject<IgniteGuid>();
+ }
+ }
+
+ public class PrimitiveFieldsSerializer : IBinarySerializer
+ {
+ public unsafe void WriteBinary(object obj, IBinaryWriter writer)
+ {
+ PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
+
+ writer.WriteBoolean("bool", obj0.PBool);
+ writer.WriteByte("byte", obj0.PByte);
+ writer.WriteShort("short", obj0.PShort);
+ writer.WriteInt("int", obj0.PInt);
+ writer.WriteLong("long", obj0.PLong);
+ writer.WriteChar("char", obj0.PChar);
+ writer.WriteFloat("float", obj0.PFloat);
+ writer.WriteDouble("double", obj0.PDouble);
+
+ sbyte sByte = obj0.PSbyte;
+ ushort uShort = obj0.PUshort;
+ uint uInt = obj0.PUint;
+ ulong uLong = obj0.PUlong;
+
+ writer.WriteByte("sbyte", *(byte*)&sByte);
+ writer.WriteShort("ushort", *(short*)&uShort);
+ writer.WriteInt("uint", *(int*)&uInt);
+ writer.WriteLong("ulong", *(long*)&uLong);
+
+ writer.WriteString("string", obj0.PString);
+ writer.WriteGuid("guid", obj0.PGuid);
+ writer.WriteGuid("nguid", obj0.PnGuid);
+
+ writer.WriteObject("iguid", obj0.IgniteGuid);
+ }
+
+ public unsafe void ReadBinary(object obj, IBinaryReader reader)
+ {
+ PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
+
+ obj0.PBool = reader.ReadBoolean("bool");
+ obj0.PByte = reader.ReadByte("byte");
+ obj0.PShort = reader.ReadShort("short");
+ obj0.PInt = reader.ReadInt("int");
+
+ obj0.PLong = reader.ReadLong("long");
+ obj0.PChar = reader.ReadChar("char");
+ obj0.PFloat = reader.ReadFloat("float");
+ obj0.PDouble = reader.ReadDouble("double");
+
+ byte sByte = reader.ReadByte("sbyte");
+ short uShort = reader.ReadShort("ushort");
+ int uInt = reader.ReadInt("uint");
+ long uLong = reader.ReadLong("ulong");
+
+ obj0.PSbyte = *(sbyte*)&sByte;
+ obj0.PUshort = *(ushort*)&uShort;
+ obj0.PUint = *(uint*)&uInt;
+ obj0.PUlong = *(ulong*)&uLong;
+
+ obj0.PString = reader.ReadString("string");
+ obj0.PGuid = reader.ReadObject<Guid>("guid");
+ obj0.PnGuid = reader.ReadGuid("nguid");
+
+ obj0.IgniteGuid = reader.ReadObject<IgniteGuid>("iguid");
+ }
+ }
+
+ public class PrimitiveFieldsRawSerializer : IBinarySerializer
+ {
+ public unsafe void WriteBinary(object obj, IBinaryWriter writer)
+ {
+ PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
+
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteBoolean(obj0.PBool);
+ rawWriter.WriteByte(obj0.PByte);
+ rawWriter.WriteShort( obj0.PShort);
+ rawWriter.WriteInt( obj0.PInt);
+ rawWriter.WriteLong( obj0.PLong);
+ rawWriter.WriteChar(obj0.PChar);
+ rawWriter.WriteFloat(obj0.PFloat);
+ rawWriter.WriteDouble( obj0.PDouble);
+
+ sbyte sByte = obj0.PSbyte;
+ ushort uShort = obj0.PUshort;
+ uint uInt = obj0.PUint;
+ ulong uLong = obj0.PUlong;
+
+ rawWriter.WriteByte(*(byte*)&sByte);
+ rawWriter.WriteShort(*(short*)&uShort);
+ rawWriter.WriteInt(*(int*)&uInt);
+ rawWriter.WriteLong(*(long*)&uLong);
+
+ rawWriter.WriteString(obj0.PString);
+ rawWriter.WriteGuid(obj0.PGuid);
+ rawWriter.WriteGuid(obj0.PnGuid);
+
+ rawWriter.WriteObject(obj0.IgniteGuid);
+ }
+
+ public unsafe void ReadBinary(object obj, IBinaryReader reader)
+ {
+ PrimitiveFieldType obj0 = (PrimitiveFieldType)obj;
+
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ obj0.PBool = rawReader.ReadBoolean();
+ obj0.PByte = rawReader.ReadByte();
+ obj0.PShort = rawReader.ReadShort();
+ obj0.PInt = rawReader.ReadInt();
+ obj0.PLong = rawReader.ReadLong();
+ obj0.PChar = rawReader.ReadChar();
+ obj0.PFloat = rawReader.ReadFloat();
+ obj0.PDouble = rawReader.ReadDouble();
+
+ byte sByte = rawReader.ReadByte();
+ short uShort = rawReader.ReadShort();
+ int uInt = rawReader.ReadInt();
+ long uLong = rawReader.ReadLong();
+
+ obj0.PSbyte = *(sbyte*)&sByte;
+ obj0.PUshort = *(ushort*)&uShort;
+ obj0.PUint = *(uint*)&uInt;
+ obj0.PUlong = *(ulong*)&uLong;
+
+ obj0.PString = rawReader.ReadString();
+ obj0.PGuid = rawReader.ReadGuid().Value;
+ obj0.PnGuid = rawReader.ReadGuid();
+
+ obj0.IgniteGuid = rawReader.ReadObject<IgniteGuid>();
+ }
+ }
+
+ public class HandleOuter : IBinarizable
+ {
+ public string Before;
+ public HandleInner Inner;
+ public string After;
+
+ public string RawBefore;
+ public HandleInner RawInner;
+ public string RawAfter;
+
+ /** <inheritdoc /> */
+ virtual public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteString("before", Before);
+ writer.WriteObject("inner", Inner);
+ writer.WriteString("after", After);
+
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteString(RawBefore);
+ rawWriter.WriteObject(RawInner);
+ rawWriter.WriteString(RawAfter);
+ }
+
+ /** <inheritdoc /> */
+ virtual public void ReadBinary(IBinaryReader reader)
+ {
+ Before = reader.ReadString("before");
+ Inner = reader.ReadObject<HandleInner>("inner");
+ After = reader.ReadString("after");
+
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ RawBefore = rawReader.ReadString();
+ RawInner = rawReader.ReadObject<HandleInner>();
+ RawAfter = rawReader.ReadString();
+ }
+ }
+
+ public class HandleInner : IBinarizable
+ {
+ public string Before;
+ public HandleOuter Outer;
+ public string After;
+
+ public string RawBefore;
+ public HandleOuter RawOuter;
+ public string RawAfter;
+
+ /** <inheritdoc /> */
+ virtual public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteString("before", Before);
+ writer.WriteObject("outer", Outer);
+ writer.WriteString("after", After);
+
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteString(RawBefore);
+ rawWriter.WriteObject(RawOuter);
+ rawWriter.WriteString(RawAfter);
+ }
+
+ /** <inheritdoc /> */
+ virtual public void ReadBinary(IBinaryReader reader)
+ {
+ Before = reader.ReadString("before");
+ Outer = reader.ReadObject<HandleOuter>("outer");
+ After = reader.ReadString("after");
+
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ RawBefore = rawReader.ReadString();
+ RawOuter = rawReader.ReadObject<HandleOuter>();
+ RawAfter = rawReader.ReadString();
+ }
+ }
+
+
+ public class HandleOuterExclusive : HandleOuter
+ {
+ /** <inheritdoc /> */
+ override public void WriteBinary(IBinaryWriter writer)
+ {
+ BinaryWriter writer0 = (BinaryWriter)writer;
+
+ writer.WriteString("before", Before);
+
+ writer0.WithDetach(w => w.WriteObject("inner", Inner));
+
+ writer.WriteString("after", After);
+
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteString(RawBefore);
+
+ writer0.WithDetach(w => w.WriteObject(RawInner));
+
+ rawWriter.WriteString(RawAfter);
+ }
+
+ /** <inheritdoc /> */
+ override public void ReadBinary(IBinaryReader reader)
+ {
+ var reader0 = (BinaryReader) reader;
+
+ Before = reader0.ReadString("before");
+
+ reader0.DetachNext();
+ Inner = reader0.ReadObject<HandleInner>("inner");
+
+ After = reader0.ReadString("after");
+
+ var rawReader = (BinaryReader) reader.GetRawReader();
+
+ RawBefore = rawReader.ReadString();
+
+ reader0.DetachNext();
+ RawInner = rawReader.ReadObject<HandleInner>();
+
+ RawAfter = rawReader.ReadString();
+ }
+ }
+
+ public class PropertyType
+ {
+ public int Field1;
+
+ public int Field2
+ {
+ get;
+ set;
+ }
+ }
+
+ public enum TestEnum
+ {
+ Val1, Val2, Val3 = 10
+ }
+
+ public class DecimalReflective
+ {
+ /** */
+ public decimal? Val;
+
+ /** */
+ public decimal?[] ValArr;
+ }
+
+ public class DecimalMarshalAware : DecimalReflective, IBinarizable
+ {
+ /** */
+ public decimal? RawVal;
+
+ /** */
+ public decimal?[] RawValArr;
+
+ /** <inheritDoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteDecimal("val", Val);
+ writer.WriteDecimalArray("valArr", ValArr);
+
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteDecimal(RawVal);
+ rawWriter.WriteDecimalArray(RawValArr);
+ }
+
+ /** <inheritDoc /> */
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Val = reader.ReadDecimal("val");
+ ValArr = reader.ReadDecimalArray("valArr");
+
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ RawVal = rawReader.ReadDecimal();
+ RawValArr = rawReader.ReadDecimalArray();
+ }
+ }
+
+ /// <summary>
+ /// Date time type.
+ /// </summary>
+ public class DateTimeType : IBinarizable
+ {
+ public DateTime Utc;
+
+ public DateTime? UtcNull;
+
+ public DateTime?[] UtcArr;
+
+ public DateTime UtcRaw;
+
+ public DateTime? UtcNullRaw;
+
+ public DateTime?[] UtcArrRaw;
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="now">Current local time.</param>
+ public DateTimeType(DateTime now)
+ {
+ Utc = now.ToUniversalTime();
+
+ UtcNull = Utc;
+
+ UtcArr = new DateTime?[] { Utc };
+
+ UtcRaw = Utc;
+
+ UtcNullRaw = UtcNull;
+
+ UtcArrRaw = new[] { UtcArr[0] };
+ }
+
+ /** <inheritDoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteTimestamp("utc", Utc);
+ writer.WriteTimestamp("utcNull", UtcNull);
+ writer.WriteTimestampArray("utcArr", UtcArr);
+
+ IBinaryRawWriter rawWriter = writer.GetRawWriter();
+
+ rawWriter.WriteTimestamp(UtcRaw);
+ rawWriter.WriteTimestamp(UtcNullRaw);
+ rawWriter.WriteTimestampArray(UtcArrRaw);
+ }
+
+ /** <inheritDoc /> */
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Utc = reader.ReadTimestamp("utc").Value;
+ UtcNull = reader.ReadTimestamp("utc").Value;
+ UtcArr = reader.ReadTimestampArray("utcArr");
+
+ IBinaryRawReader rawReader = reader.GetRawReader();
+
+ UtcRaw = rawReader.ReadTimestamp().Value;
+ UtcNullRaw = rawReader.ReadTimestamp().Value;
+ UtcArrRaw = rawReader.ReadTimestampArray();
+ }
+ }
+
+ [Serializable]
+ private class SerializableObject
+ {
+ public int Foo { get; set; }
+
+ private bool Equals(SerializableObject other)
+ {
+ return Foo == other.Foo;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != GetType()) return false;
+
+ return Equals((SerializableObject) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return Foo;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
new file mode 100644
index 0000000..78ee8c0
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
@@ -0,0 +1,250 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Binary;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Contains tests for binary type structure.
+ /// </summary>
+ [TestFixture]
+ public class BinaryStructureTest
+ {
+ /** Repeat count. */
+ public static readonly int RepeatCnt = 10;
+
+ /** Objects per mode. */
+ public static readonly int ObjectsPerMode = 5;
+
+ /// <summary>
+ /// Test object write with different structures.
+ /// </summary>
+ [Test]
+ public void TestStructure()
+ {
+ for (int i = 1; i <= RepeatCnt; i++)
+ {
+ Console.WriteLine(">>> Iteration started: " + i);
+
+ // 1. Generate and shuffle objects.
+ IList<BranchedType> objs = new List<BranchedType>();
+
+ for (int j = 0; j < 6 * ObjectsPerMode; j++)
+ objs.Add(new BranchedType((j%6) + 1));
+
+ objs = IgniteUtils.Shuffle(objs);
+
+ // 2. Create new marshaller.
+ BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(typeof(BranchedType));
+
+ BinaryConfiguration cfg = new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration> { typeCfg }
+ };
+
+ Marshaller marsh = new Marshaller(cfg);
+
+ // 3. Marshal all data and ensure deserialized object is fine.
+ foreach (BranchedType obj in objs)
+ {
+ Console.WriteLine(">>> Write object [mode=" + obj.mode + ']');
+
+ byte[] data = marsh.Marshal(obj);
+
+ BranchedType other = marsh.Unmarshal<BranchedType>(data);
+
+ Assert.IsTrue(obj.Equals(other));
+ }
+
+ Console.WriteLine();
+
+ // 4. Ensure that all fields are recorded.
+ var desc = marsh.GetDescriptor(typeof (BranchedType));
+
+ CollectionAssert.AreEquivalent(new[] {"mode", "f2", "f3", "f4", "f5", "f6", "f7", "f8"},
+ desc.WriterTypeStructure.FieldTypes.Keys);
+ }
+ }
+ }
+
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
+ public class BranchedType : IBinarizable
+ {
+ public int mode;
+ public int f2;
+ public int f3;
+ public int f4;
+ public int f5;
+ public int f6;
+ public int f7;
+ public int f8;
+
+ public BranchedType(int mode)
+ {
+ this.mode = mode;
+
+ switch (mode)
+ {
+ case 1:
+ f2 = 2;
+
+ break;
+
+ case 2:
+ f2 = 2;
+ f3 = 3;
+ f4 = 4;
+
+ break;
+
+ case 3:
+ f2 = 2;
+ f3 = 3;
+ f5 = 5;
+
+ break;
+
+ case 4:
+ f2 = 2;
+ f3 = 3;
+ f5 = 5;
+ f6 = 6;
+
+ break;
+
+ case 5:
+ f2 = 2;
+ f3 = 3;
+ f7 = 7;
+
+ break;
+
+ case 6:
+ f8 = 8;
+
+ break;
+ }
+ }
+
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteInt("mode", mode);
+
+ switch (mode)
+ {
+ case 1:
+ writer.WriteInt("f2", f2);
+
+ break;
+
+ case 2:
+ writer.WriteInt("f2", f2);
+ writer.WriteInt("f3", f3);
+ writer.WriteInt("f4", f4);
+
+ break;
+
+ case 3:
+ writer.WriteInt("f2", f2);
+ writer.WriteInt("f3", f3);
+ writer.WriteInt("f5", f5);
+
+ break;
+
+ case 4:
+ writer.WriteInt("f2", f2);
+ writer.WriteInt("f3", f3);
+ writer.WriteInt("f5", f5);
+ writer.WriteInt("f6", f6);
+
+ break;
+
+ case 5:
+ writer.WriteInt("f2", f2);
+ writer.WriteInt("f3", f3);
+ writer.WriteInt("f7", f7);
+
+ break;
+
+ case 6:
+ writer.WriteInt("f8", f8);
+
+ break;
+ }
+ }
+
+ public void ReadBinary(IBinaryReader reader)
+ {
+ mode = reader.ReadInt("mode");
+
+ switch (mode)
+ {
+ case 1:
+ f2 = reader.ReadInt("f2");
+
+ break;
+
+ case 2:
+ f2 = reader.ReadInt("f2");
+ f3 = reader.ReadInt("f3");
+ f4 = reader.ReadInt("f4");
+
+ break;
+
+ case 3:
+ f2 = reader.ReadInt("f2");
+ f3 = reader.ReadInt("f3");
+ f5 = reader.ReadInt("f5");
+
+ break;
+
+ case 4:
+ f2 = reader.ReadInt("f2");
+ f3 = reader.ReadInt("f3");
+ f5 = reader.ReadInt("f5");
+ f6 = reader.ReadInt("f6");
+
+ break;
+
+ case 5:
+ f2 = reader.ReadInt("f2");
+ f3 = reader.ReadInt("f3");
+ f7 = reader.ReadInt("f7");
+
+ break;
+
+ case 6:
+ f8 = reader.ReadInt("f8");
+
+ break;
+ }
+ }
+
+ public bool Equals(BranchedType other)
+ {
+ return mode == other.mode && f2 == other.f2 && f3 == other.f3 && f4 == other.f4 && f5 == other.f5 &&
+ f6 == other.f6 && f7 == other.f7 && f8 == other.f8;
+ }
+ }
+}
[24/50] [abbrv] ignite git commit: ignite-1.5 Minor fix in JDBC POJO
store.
Posted by vo...@apache.org.
ignite-1.5 Minor fix in JDBC POJO store.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5887ae4d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5887ae4d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5887ae4d
Branch: refs/heads/ignite-1816
Commit: 5887ae4d7a318089bb8b19e56cbecc782be1ba76
Parents: 1f5a409
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 13 10:44:35 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 13 10:44:35 2015 +0700
----------------------------------------------------------------------
.../store/jdbc/CacheAbstractJdbcStore.java | 34 +++++++++++---------
1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5887ae4d/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 6e27b9a..6e19234 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -354,22 +354,26 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
Transaction tx = ses.transaction();
if (tx != null) {
- Connection conn = ses.<String, Connection>properties().remove(ATTR_CONN_PROP);
+ Map<String, Connection> sesProps = ses.properties();
- assert conn != null;
+ Connection conn = sesProps.get(ATTR_CONN_PROP);
- try {
- if (commit)
- conn.commit();
- else
- conn.rollback();
- }
- catch (SQLException e) {
- throw new CacheWriterException(
- "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e);
- }
- finally {
- U.closeQuiet(conn);
+ if (conn != null) {
+ sesProps.remove(ATTR_CONN_PROP);
+
+ try {
+ if (commit)
+ conn.commit();
+ else
+ conn.rollback();
+ }
+ catch (SQLException e) {
+ throw new CacheWriterException(
+ "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e);
+ }
+ finally {
+ U.closeQuiet(conn);
+ }
}
if (log.isDebugEnabled())
@@ -1821,4 +1825,4 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
}
}
-}
\ No newline at end of file
+}
[32/50] [abbrv] ignite git commit: Renaming.
Posted by vo...@apache.org.
Renaming.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6fa22e2e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6fa22e2e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6fa22e2e
Branch: refs/heads/ignite-1816
Commit: 6fa22e2e2e00dbb665b3eba24121b756716297d7
Parents: b278fe3
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Nov 17 13:42:40 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 17 13:42:40 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 28 ++++++++++----------
.../processors/cache/GridCacheProcessor.java | 4 +--
.../cache/store/CacheOsStoreManager.java | 2 +-
.../GridCachePortableStoreAbstractSelfTest.java | 2 +-
4 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6fa22e2e/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 9cde3a2..5b246b3 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
@@ -206,9 +206,9 @@ 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 .*/
+ /** Default value for keep binary in store behavior .*/
@SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"})
- public static final Boolean DFLT_KEEP_PORTABLE_IN_STORE = new Boolean(true);
+ public static final Boolean DFLT_KEEP_BINARY_IN_STORE = new Boolean(true);
/** Default threshold for concurrent loading of keys from {@link CacheStore}. */
public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5;
@@ -269,7 +269,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
private Factory storeFactory;
/** */
- private Boolean keepPortableInStore = DFLT_KEEP_PORTABLE_IN_STORE;
+ private Boolean keepBinaryInStore = DFLT_KEEP_BINARY_IN_STORE;
/** */
private boolean loadPrevVal = DFLT_LOAD_PREV_VAL;
@@ -441,8 +441,8 @@ 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;
+ keepBinaryInStore = cc.isKeepBinaryInStore() != null ? cc.isKeepBinaryInStore() :
+ DFLT_KEEP_BINARY_IN_STORE;
listenerConfigurations = cc.listenerConfigurations;
loadPrevVal = cc.isLoadPreviousValue();
longQryWarnTimeout = cc.getLongQueryWarningTimeout();
@@ -886,34 +886,34 @@ 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},
+ * is working with binary objects instead of Java objects.
+ * Default value of this flag is {@link #DFLT_KEEP_BINARY_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
+ * values stored in binary 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
+ * of binary objects. You will also need to have key and value
* classes on all nodes since binary will be deserialized when
* store is called.
*
* @return Keep binary in store flag.
*/
- public Boolean isKeepPortableInStore() {
- return keepPortableInStore;
+ public Boolean isKeepBinaryInStore() {
+ return keepBinaryInStore;
}
/**
* Sets keep binary in store flag.
*
- * @param keepPortableInStore Keep binary in store flag.
+ * @param keepBinaryInStore Keep binary in store flag.
*/
- public void setKeepPortableInStore(boolean keepPortableInStore) {
- this.keepPortableInStore = keepPortableInStore;
+ public void setKeepBinaryInStore(boolean keepBinaryInStore) {
+ this.keepBinaryInStore = keepBinaryInStore;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/6fa22e2e/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 395e827..4fe8d84 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
@@ -1018,9 +1018,9 @@ 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
+ if (cfg.isKeepBinaryInStore() && cfg.isKeepBinaryInStore() != CacheConfiguration.DFLT_KEEP_BINARY_IN_STORE
&& !(ctx.config().getMarshaller() instanceof PortableMarshaller))
- U.warn(log, "CacheConfiguration.isKeepPortableInStore() configuration property will be ignored because " +
+ U.warn(log, "CacheConfiguration.isKeepBinaryInStore() configuration property will be ignored because " +
"PortableMarshaller is not used");
// Start managers.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6fa22e2e/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..b84908d 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
@@ -82,6 +82,6 @@ public class CacheOsStoreManager extends GridCacheStoreManagerAdapter {
/** {@inheritDoc} */
@Override public boolean configuredConvertPortable() {
- return !(ctx.config().getMarshaller() instanceof PortableMarshaller && cfg.isKeepPortableInStore());
+ return !(ctx.config().getMarshaller() instanceof PortableMarshaller && cfg.isKeepBinaryInStore());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/6fa22e2e/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
index 1c842e1..13a4c12 100644
--- 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
@@ -59,7 +59,7 @@ public abstract class GridCachePortableStoreAbstractSelfTest extends GridCommonA
CacheConfiguration cacheCfg = new CacheConfiguration();
cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
- cacheCfg.setKeepPortableInStore(keepPortableInStore());
+ cacheCfg.setKeepBinaryInStore(keepPortableInStore());
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
[33/50] [abbrv] ignite git commit: Fixing ignite-1377
Posted by vo...@apache.org.
Fixing ignite-1377
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c00e4ac4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c00e4ac4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c00e4ac4
Branch: refs/heads/ignite-1816
Commit: c00e4ac48d1d9e0629f8f589612c16c726548152
Parents: 6fa22e2
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Nov 17 15:53:24 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 17 15:53:24 2015 +0300
----------------------------------------------------------------------
.../internal/portable/PortableContext.java | 4 +-
.../CacheObjectBinaryProcessorImpl.java | 2 +-
.../resources/META-INF/classnames.properties | 196 +++++++++++++------
3 files changed, 138 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c00e4ac4/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 f779706..928be63 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
@@ -570,9 +570,7 @@ public class PortableContext implements Externalizable {
mappers.putIfAbsent(typeId, idMapper);
- // TODO uncomment for https://issues.apache.org/jira/browse/IGNITE-1377
-// if (registerMetadata && isMetaDataEnabled(typeId))
-// metaHnd.addMeta(typeId, new PortableMetaDataImpl(typeName, desc.fieldsMeta(), null));
+ metaHnd.addMeta(typeId, new BinaryMetaDataImpl(typeName, desc.fieldsMeta(), null));
return desc;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c00e4ac4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index 2b3aa09..98b619e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -337,7 +337,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void onUtilityCacheStarted() throws IgniteCheckedException {
- metaDataCache = ctx.cache().jcache(CU.UTILITY_CACHE_NAME);
+ metaDataCache = (IgniteCacheProxy)ctx.cache().jcache(CU.UTILITY_CACHE_NAME).withNoRetries();
if (clientNode) {
assert !metaDataCache.context().affinityNode();
http://git-wip-us.apache.org/repos/asf/ignite/blob/c00e4ac4/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 9376613..4b2c8ee 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -23,6 +23,9 @@ org.apache.ignite.IgniteException
org.apache.ignite.IgniteIllegalStateException
org.apache.ignite.IgniteInterruptedException
org.apache.ignite.IgniteState
+org.apache.ignite.binary.BinaryInvalidTypeException
+org.apache.ignite.binary.BinaryObject
+org.apache.ignite.binary.BinaryObjectException
org.apache.ignite.cache.CacheAtomicUpdateTimeoutException
org.apache.ignite.cache.CacheAtomicWriteOrderMode
org.apache.ignite.cache.CacheAtomicityMode
@@ -31,6 +34,7 @@ org.apache.ignite.cache.CacheEntryProcessor
org.apache.ignite.cache.CacheExistsException
org.apache.ignite.cache.CacheInterceptor
org.apache.ignite.cache.CacheInterceptorAdapter
+org.apache.ignite.cache.CacheKeyConfiguration
org.apache.ignite.cache.CacheMemoryMode
org.apache.ignite.cache.CacheMode
org.apache.ignite.cache.CachePartialUpdateException
@@ -40,6 +44,9 @@ org.apache.ignite.cache.CacheServerNotFoundException
org.apache.ignite.cache.CacheTypeFieldMetadata
org.apache.ignite.cache.CacheTypeMetadata
org.apache.ignite.cache.CacheWriteSynchronizationMode
+org.apache.ignite.cache.QueryEntity
+org.apache.ignite.cache.QueryIndex
+org.apache.ignite.cache.QueryIndexType
org.apache.ignite.cache.affinity.AffinityFunction
org.apache.ignite.cache.affinity.AffinityKey
org.apache.ignite.cache.affinity.AffinityKeyMapper
@@ -48,6 +55,9 @@ org.apache.ignite.cache.affinity.AffinityNodeHashResolver
org.apache.ignite.cache.affinity.AffinityNodeIdHashResolver
org.apache.ignite.cache.affinity.AffinityUuid
org.apache.ignite.cache.affinity.fair.FairAffinityFunction
+org.apache.ignite.cache.affinity.fair.FairAffinityFunction$1
+org.apache.ignite.cache.affinity.fair.FairAffinityFunction$FullAssignmentMap$1
+org.apache.ignite.cache.affinity.fair.FairAffinityFunction$FullAssignmentMap$2
org.apache.ignite.cache.affinity.fair.FairAffinityFunction$PartitionSetComparator
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction$HashComparator
@@ -205,7 +215,7 @@ org.apache.ignite.internal.IgniteFutureTimeoutCheckedException
org.apache.ignite.internal.IgniteInterruptedCheckedException
org.apache.ignite.internal.IgniteKernal
org.apache.ignite.internal.IgniteKernal$1
-org.apache.ignite.internal.IgniteKernal$5
+org.apache.ignite.internal.IgniteKernal$4
org.apache.ignite.internal.IgniteMessagingImpl
org.apache.ignite.internal.IgniteSchedulerImpl
org.apache.ignite.internal.IgniteServicesImpl
@@ -254,10 +264,6 @@ org.apache.ignite.internal.executor.GridExecutorService
org.apache.ignite.internal.executor.GridExecutorService$1
org.apache.ignite.internal.executor.GridExecutorService$TaskTerminateListener
org.apache.ignite.internal.igfs.common.IgfsIpcCommand
-org.apache.ignite.internal.interop.InteropAwareEventFilter
-org.apache.ignite.internal.interop.InteropBootstrapFactory
-org.apache.ignite.internal.interop.InteropException
-org.apache.ignite.internal.interop.InteropNoCallbackException
org.apache.ignite.internal.jdbc2.JdbcConnection$JdbcConnectionValidationTask
org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask
@@ -269,7 +275,6 @@ org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
org.apache.ignite.internal.managers.communication.GridIoManager$ConcurrentHashMap0
org.apache.ignite.internal.managers.communication.GridIoMessage
org.apache.ignite.internal.managers.communication.GridIoUserMessage
-org.apache.ignite.internal.managers.communication.GridLifecycleAwareMessageFilter
org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean
org.apache.ignite.internal.managers.deployment.GridDeploymentPerVersionStore$2
org.apache.ignite.internal.managers.deployment.GridDeploymentRequest
@@ -287,14 +292,14 @@ org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage
org.apache.ignite.internal.managers.indexing.GridIndexingManager$1
org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerAdapter
org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1
-org.apache.ignite.internal.processors.platform.PlatformAwareEventFilter
+org.apache.ignite.internal.portable.BinaryMetaDataImpl
+org.apache.ignite.internal.portable.BinaryObjectEx
+org.apache.ignite.internal.portable.BinaryObjectImpl
+org.apache.ignite.internal.portable.BinaryObjectOffheapImpl
+org.apache.ignite.internal.portable.BinaryReaderExImpl$Flag
org.apache.ignite.internal.portable.PortableClassDescriptor$Mode
org.apache.ignite.internal.portable.PortableContext
org.apache.ignite.internal.portable.builder.PortableLazyMap$1$1$1
-org.apache.ignite.internal.portable.PortableMetaDataImpl
-org.apache.ignite.internal.portable.PortableObjectEx
-org.apache.ignite.internal.portable.PortableObjectImpl
-org.apache.ignite.internal.portable.PortableObjectOffheapImpl
org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion
org.apache.ignite.internal.processors.affinity.GridAffinityAssignment
org.apache.ignite.internal.processors.affinity.GridAffinityMessage
@@ -326,38 +331,39 @@ org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQu
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
org.apache.ignite.internal.processors.cache.GridCacheAdapter
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$10
org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$13$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$15$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$25$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$23$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$25
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$27
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$28$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$29
org.apache.ignite.internal.processors.cache.GridCacheAdapter$3
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$31
org.apache.ignite.internal.processors.cache.GridCacheAdapter$4
org.apache.ignite.internal.processors.cache.GridCacheAdapter$6
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$62
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$63
org.apache.ignite.internal.processors.cache.GridCacheAdapter$64
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$65
org.apache.ignite.internal.processors.cache.GridCacheAdapter$66
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$67
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$67$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$68
org.apache.ignite.internal.processors.cache.GridCacheAdapter$69
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$69$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$7
org.apache.ignite.internal.processors.cache.GridCacheAdapter$70
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$71
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$72
org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$ClearTask
org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllJob
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllNearJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearKeySetJob
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearKeySetNearJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallable
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeJob
@@ -407,7 +413,6 @@ org.apache.ignite.internal.processors.cache.GridCacheGateway$State
org.apache.ignite.internal.processors.cache.GridCacheIndexUpdateException
org.apache.ignite.internal.processors.cache.GridCacheIoManager$1$1
org.apache.ignite.internal.processors.cache.GridCacheIoManager$2
-org.apache.ignite.internal.processors.cache.GridCacheIoManager$3
org.apache.ignite.internal.processors.cache.GridCacheIterator
org.apache.ignite.internal.processors.cache.GridCacheKeySet
org.apache.ignite.internal.processors.cache.GridCacheLoaderWriterStore
@@ -421,8 +426,6 @@ org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate$Mask
org.apache.ignite.internal.processors.cache.GridCacheMvccManager$4
org.apache.ignite.internal.processors.cache.GridCacheMvccManager$5
org.apache.ignite.internal.processors.cache.GridCacheMvccManager$6
-org.apache.ignite.internal.processors.cache.GridCacheMvccManager$7
-org.apache.ignite.internal.processors.cache.GridCacheMvccManager$8
org.apache.ignite.internal.processors.cache.GridCacheMvccManager$FinishLockFuture$1
org.apache.ignite.internal.processors.cache.GridCacheOperation
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$1$1
@@ -436,24 +439,27 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$Me
org.apache.ignite.internal.processors.cache.GridCacheProcessor$2
org.apache.ignite.internal.processors.cache.GridCacheProcessor$3
org.apache.ignite.internal.processors.cache.GridCacheProcessor$4
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$5
org.apache.ignite.internal.processors.cache.GridCacheProcessor$6
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$8
org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunction
org.apache.ignite.internal.processors.cache.GridCacheProxyImpl
org.apache.ignite.internal.processors.cache.GridCacheReturn
-org.apache.ignite.internal.processors.cache.GridCacheSwapManager$10
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$12
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$14
-org.apache.ignite.internal.processors.cache.GridCacheSwapManager$15
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$16
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$17
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$18
-org.apache.ignite.internal.processors.cache.GridCacheSwapManager$2
-org.apache.ignite.internal.processors.cache.GridCacheSwapManager$21
+org.apache.ignite.internal.processors.cache.GridCacheSwapManager$19
+org.apache.ignite.internal.processors.cache.GridCacheSwapManager$20
+org.apache.ignite.internal.processors.cache.GridCacheSwapManager$23
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$3
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$4
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$5
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$6
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$7
+org.apache.ignite.internal.processors.cache.GridCacheSwapManager$8
+org.apache.ignite.internal.processors.cache.GridCacheSwapManager$9
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$CloseablePartitionsIterator
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$IteratorWrapper
org.apache.ignite.internal.processors.cache.GridCacheTryPutFailedException
@@ -484,13 +490,15 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
org.apache.ignite.internal.processors.cache.GridCacheUtils$9
org.apache.ignite.internal.processors.cache.GridCacheValueCollection
org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
-org.apache.ignite.internal.processors.cache.GridLoadCacheCloseablePredicate
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$3
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$4
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$5
-org.apache.ignite.internal.processors.cache.IgniteCacheProxy$6
-org.apache.ignite.internal.processors.cache.IgniteCacheProxy$7
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
@@ -501,6 +509,7 @@ org.apache.ignite.internal.processors.cache.distributed.GridCacheCommittedTxInfo
org.apache.ignite.internal.processors.cache.distributed.GridCacheTtlUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$1
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$2
+org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$3
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryRequest
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryResponse
org.apache.ignite.internal.processors.cache.distributed.GridDistributedBaseMessage
@@ -543,6 +552,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionStat
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionsReservation$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$1
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$10
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$3
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4
@@ -552,8 +562,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactional
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$8
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$9
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$9$1
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$9$1$1
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$9$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest
@@ -568,6 +576,8 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFutu
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$5
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$6
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote
@@ -575,9 +585,11 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$2
+org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$2
-org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$2$1
+org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$3
+org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$3$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$10
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$11
@@ -605,7 +617,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$UpdateState$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
@@ -618,7 +630,9 @@ org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtCol
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$5
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$MiniFuture$1
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage
@@ -664,9 +678,11 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapte
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$EntrySet$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$2
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$MiniFuture$2
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$MiniFuture$2$1
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$MiniFuture$3
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$MiniFuture$3$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$1
@@ -676,11 +692,18 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$1
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$2
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$3
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$4
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$ClientRemapFuture$1
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$MiniFuture$1
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticSerializableTxPrepareFuture$MiniFuture$1$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$3
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$MiniFuture$1
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFutureAdapter$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$3
@@ -714,13 +737,12 @@ org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$5
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$6
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$9
org.apache.ignite.internal.processors.cache.portable.CacheDefaultPortableAffinityKeyMapper
-org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl$1
-org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl$4
-org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl$MetaDataEntryFilter
-org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl$MetaDataPredicate
-org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl$MetaDataProcessor
+org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$1
+org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$4
+org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter
+org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$MetaDataPredicate
+org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$MetaDataProcessor
org.apache.ignite.internal.processors.cache.portable.PortableMetaDataKey
-org.apache.ignite.internal.processors.cache.query.CacheQueryCloseableScanBiPredicate
org.apache.ignite.internal.processors.cache.query.CacheQueryType
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture$1
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture$3
@@ -730,9 +752,6 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$6
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$CacheQueryFallbackFuture$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$CacheQueryFallbackFuture$1$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1
@@ -767,7 +786,6 @@ org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEntry
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent
-org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFilterEx
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$2
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$DeployableObject
@@ -782,7 +800,6 @@ org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidat
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$1
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$2
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3
-org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$4
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StatefulValue
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StoreOperation
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$ValueStatus
@@ -795,7 +812,6 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$11
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$12
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$13
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$14
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$15
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$4
@@ -806,20 +822,17 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$8
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$9
org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$1
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$10
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$11
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$12
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$13
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$14
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$15
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$16
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$2
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$4
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$5
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$6
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$7
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$8
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$9
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$FinishClosure
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PLC1
@@ -1008,9 +1021,10 @@ org.apache.ignite.internal.processors.igfs.IgfsInvalidRangeException
org.apache.ignite.internal.processors.igfs.IgfsIpcHandler$2
org.apache.ignite.internal.processors.igfs.IgfsJobImpl
org.apache.ignite.internal.processors.igfs.IgfsListingEntry
-org.apache.ignite.internal.processors.igfs.IgfsMetaManager$1
org.apache.ignite.internal.processors.igfs.IgfsMetaManager$2
-org.apache.ignite.internal.processors.igfs.IgfsMetaManager$3$1
+org.apache.ignite.internal.processors.igfs.IgfsMetaManager$3
+org.apache.ignite.internal.processors.igfs.IgfsMetaManager$4
+org.apache.ignite.internal.processors.igfs.IgfsMetaManager$LockFileProcessor
org.apache.ignite.internal.processors.igfs.IgfsMetaManager$UpdateListing
org.apache.ignite.internal.processors.igfs.IgfsMetaManager$UpdateListingEntry
org.apache.ignite.internal.processors.igfs.IgfsMetaManager$UpdatePath
@@ -1030,6 +1044,65 @@ org.apache.ignite.internal.processors.job.GridJobProcessor$6
org.apache.ignite.internal.processors.job.GridJobProcessor$7
org.apache.ignite.internal.processors.job.GridJobWorker$3
org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer
+org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
+org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
+org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
+org.apache.ignite.internal.processors.platform.PlatformException
+org.apache.ignite.internal.processors.platform.PlatformExtendedException
+org.apache.ignite.internal.processors.platform.PlatformNativeException
+org.apache.ignite.internal.processors.platform.PlatformNoCallbackException
+org.apache.ignite.internal.processors.platform.cache.PlatformCache$1
+org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter
+org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl
+org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
+org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessorImpl
+org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException
+org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity$1
+org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQuery
+org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter
+org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryImpl
+org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryRemoteFilter
+org.apache.ignite.internal.processors.platform.cluster.PlatformClusterNodeFilter
+org.apache.ignite.internal.processors.platform.cluster.PlatformClusterNodeFilterImpl
+org.apache.ignite.internal.processors.platform.compute.PlatformAbstractJob
+org.apache.ignite.internal.processors.platform.compute.PlatformAbstractTask
+org.apache.ignite.internal.processors.platform.compute.PlatformBalancingMultiClosureTask
+org.apache.ignite.internal.processors.platform.compute.PlatformBalancingSingleClosureAffinityTask
+org.apache.ignite.internal.processors.platform.compute.PlatformBalancingSingleClosureTask
+org.apache.ignite.internal.processors.platform.compute.PlatformBroadcastingMultiClosureTask
+org.apache.ignite.internal.processors.platform.compute.PlatformBroadcastingSingleClosureTask
+org.apache.ignite.internal.processors.platform.compute.PlatformClosureJob
+org.apache.ignite.internal.processors.platform.compute.PlatformCompute$1
+org.apache.ignite.internal.processors.platform.compute.PlatformCompute$2
+org.apache.ignite.internal.processors.platform.compute.PlatformFullJob
+org.apache.ignite.internal.processors.platform.compute.PlatformFullTask
+org.apache.ignite.internal.processors.platform.compute.PlatformJob
+org.apache.ignite.internal.processors.platform.cpp.PlatformCppConfigurationClosure
+org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiver
+org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$1
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$2
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$3
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$4
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$5
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$5$1$1$1
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$6
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$7
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$8
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
+org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl
+org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter
+org.apache.ignite.internal.processors.platform.messaging.PlatformMessageFilterImpl
+org.apache.ignite.internal.processors.platform.messaging.PlatformMessageLocalFilter
+org.apache.ignite.internal.processors.platform.services.PlatformAbstractService
+org.apache.ignite.internal.processors.platform.services.PlatformService
+org.apache.ignite.internal.processors.platform.services.PlatformServices$2
+org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions$1
+org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$1
+org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$FutureListenable$1
+org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$InternalFutureListenable$1
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
org.apache.ignite.internal.processors.query.GridQueryIndexType
org.apache.ignite.internal.processors.query.GridQueryProcessor$2
@@ -1040,6 +1113,7 @@ org.apache.ignite.internal.processors.query.GridQueryProcessor$6
org.apache.ignite.internal.processors.query.GridQueryProcessor$7
org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$9
+org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
@@ -1065,8 +1139,8 @@ org.apache.ignite.internal.processors.rest.client.message.GridClientTaskResultBe
org.apache.ignite.internal.processors.rest.client.message.GridClientTopologyRequest
org.apache.ignite.internal.processors.rest.client.message.GridRouterRequest
org.apache.ignite.internal.processors.rest.client.message.GridRouterResponse
-org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$1
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$2
+org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$3
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$4
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$AddCommand
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$AppendCommand
@@ -1084,6 +1158,7 @@ org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandle
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetAndRemoveCommand
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetAndReplaceCommand
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetCommand
+org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataCommand
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetricsCommand
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$PrependCommand
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$PutAllCommand
@@ -1109,6 +1184,7 @@ org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$1
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$2
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1
+org.apache.ignite.internal.processors.rest.request.RestQueryRequest$QueryType
org.apache.ignite.internal.processors.service.GridServiceAssignments
org.apache.ignite.internal.processors.service.GridServiceAssignmentsKey
org.apache.ignite.internal.processors.service.GridServiceDeployment
@@ -1219,6 +1295,8 @@ org.apache.ignite.internal.util.future.GridEmbeddedFuture$2
org.apache.ignite.internal.util.future.GridEmbeddedFuture$2$1
org.apache.ignite.internal.util.future.GridEmbeddedFuture$3
org.apache.ignite.internal.util.future.GridEmbeddedFuture$3$1
+org.apache.ignite.internal.util.future.GridEmbeddedFuture$4
+org.apache.ignite.internal.util.future.GridEmbeddedFuture$4$1
org.apache.ignite.internal.util.future.GridEmbeddedFuture$AL1
org.apache.ignite.internal.util.future.GridEmbeddedFuture$AL2
org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1
@@ -1559,6 +1637,7 @@ org.apache.ignite.lifecycle.LifecycleEventType
org.apache.ignite.marshaller.jdk.JdkMarshallerDummySerializable
org.apache.ignite.marshaller.optimized.OptimizedFieldType
org.apache.ignite.messaging.MessagingListenActor
+org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory
org.apache.ignite.plugin.CachePluginConfiguration
org.apache.ignite.plugin.PluginNotFoundException
org.apache.ignite.plugin.PluginValidationException
@@ -1572,9 +1651,6 @@ 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.services.Service
org.apache.ignite.services.ServiceConfiguration
org.apache.ignite.services.ServiceContext
[49/50] [abbrv] ignite git commit: IGNITE-1847: GIT failed to change
class name casing (2/2).
Posted by vo...@apache.org.
IGNITE-1847: GIT failed to change class name casing (2/2).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/66c84ea3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/66c84ea3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/66c84ea3
Branch: refs/heads/ignite-1816
Commit: 66c84ea32fec0a62b7a01f4094503e8ebc297fed
Parents: a0efe76
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Nov 18 10:30:46 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 18 10:30:46 2015 +0300
----------------------------------------------------------------------
.../portable/BinaryMetadataCollector.java | 254 +++++++++++++++++++
.../portable/BinaryMetadataCollector2.java | 254 -------------------
.../portable/PortableClassDescriptor.java | 2 +-
.../CacheObjectBinaryProcessorImpl.java | 44 ++--
.../cache/portable/PortableMetadataKey.java | 82 ++++++
.../cache/portable/PortableMetadataKey2.java | 82 ------
6 files changed, 359 insertions(+), 359 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c84ea3/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java
new file mode 100644
index 0000000..67e1a0d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java
@@ -0,0 +1,254 @@
+/*
+ * 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.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryWriter;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Writer for meta data collection.
+ */
+class BinaryMetadataCollector implements BinaryWriter {
+ /** */
+ private final Map<String, Integer> meta = new HashMap<>();
+
+ /** */
+ private final String typeName;
+
+ /**
+ * @param typeName Type name.
+ */
+ BinaryMetadataCollector(String typeName) {
+ this.typeName = typeName;
+ }
+
+ /**
+ * @return Field meta data.
+ */
+ Map<String, Integer> meta() {
+ return meta;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeByte(String fieldName, byte val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BYTE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeShort(String fieldName, short val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.SHORT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeInt(String fieldName, int val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.INT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeLong(String fieldName, long val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.LONG);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeFloat(String fieldName, float val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.FLOAT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDouble(String fieldName, double val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DOUBLE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeChar(String fieldName, char val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.CHAR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BOOLEAN);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DECIMAL);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.STRING);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.UUID);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DATE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.ENUM);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.OBJECT);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.INT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.LONG_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.STRING_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.UUID_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.DATE_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> void writeCollection(String fieldName, @Nullable Collection<T> col)
+ throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.COL);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws BinaryObjectException {
+ add(fieldName, PortableClassDescriptor.Mode.MAP);
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryRawWriter rawWriter() {
+ return (BinaryRawWriter)Proxy.newProxyInstance(getClass().getClassLoader(),
+ new Class<?>[] { BinaryRawWriterEx.class },
+ new InvocationHandler() {
+ @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable {
+ return null;
+ }
+ });
+ }
+
+ /**
+ * @param name Field name.
+ * @param mode Field mode.
+ * @throws BinaryObjectException In case of error.
+ */
+ private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException {
+ assert name != null;
+
+ int fieldTypeId = mode.typeId();
+
+ Integer oldFieldTypeId = meta.put(name, fieldTypeId);
+
+ if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) {
+ throw new BinaryObjectException(
+ "Field is written twice with different types [" +
+ "typeName=" + typeName +
+ ", fieldName=" + name +
+ ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) +
+ ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) +
+ ']'
+ );
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c84ea3/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java
deleted file mode 100644
index 701c619..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java
+++ /dev/null
@@ -1,254 +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.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryWriter;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Writer for meta data collection.
- */
-class BinaryMetadataCollector2 implements BinaryWriter {
- /** */
- private final Map<String, Integer> meta = new HashMap<>();
-
- /** */
- private final String typeName;
-
- /**
- * @param typeName Type name.
- */
- BinaryMetadataCollector2(String typeName) {
- this.typeName = typeName;
- }
-
- /**
- * @return Field meta data.
- */
- Map<String, Integer> meta() {
- return meta;
- }
-
- /** {@inheritDoc} */
- @Override public void writeByte(String fieldName, byte val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BYTE);
- }
-
- /** {@inheritDoc} */
- @Override public void writeShort(String fieldName, short val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.SHORT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeInt(String fieldName, int val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.INT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeLong(String fieldName, long val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.LONG);
- }
-
- /** {@inheritDoc} */
- @Override public void writeFloat(String fieldName, float val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.FLOAT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDouble(String fieldName, double val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DOUBLE);
- }
-
- /** {@inheritDoc} */
- @Override public void writeChar(String fieldName, char val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.CHAR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BOOLEAN);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DECIMAL);
- }
-
- /** {@inheritDoc} */
- @Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.STRING);
- }
-
- /** {@inheritDoc} */
- @Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.UUID);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DATE);
- }
-
- /** {@inheritDoc} */
- @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP);
- }
-
- /** {@inheritDoc} */
- @Override public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.ENUM);
- }
-
- /** {@inheritDoc} */
- @Override public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.OBJECT);
- }
-
- /** {@inheritDoc} */
- @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.INT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.LONG_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.STRING_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.UUID_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.DATE_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR);
- }
-
- /** {@inheritDoc} */
- @Override public <T> void writeCollection(String fieldName, @Nullable Collection<T> col)
- throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.COL);
- }
-
- /** {@inheritDoc} */
- @Override public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws BinaryObjectException {
- add(fieldName, PortableClassDescriptor.Mode.MAP);
- }
-
- /** {@inheritDoc} */
- @Override public BinaryRawWriter rawWriter() {
- return (BinaryRawWriter)Proxy.newProxyInstance(getClass().getClassLoader(),
- new Class<?>[] { BinaryRawWriterEx.class },
- new InvocationHandler() {
- @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable {
- return null;
- }
- });
- }
-
- /**
- * @param name Field name.
- * @param mode Field mode.
- * @throws BinaryObjectException In case of error.
- */
- private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException {
- assert name != null;
-
- int fieldTypeId = mode.typeId();
-
- Integer oldFieldTypeId = meta.put(name, fieldTypeId);
-
- if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) {
- throw new BinaryObjectException(
- "Field is written twice with different types [" +
- "typeName=" + typeName +
- ", fieldName=" + name +
- ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) +
- ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) +
- ']'
- );
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c84ea3/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 7fa6bc3..225e0ba 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
@@ -546,7 +546,7 @@ public class PortableClassDescriptor {
if (obj.getClass() != BinaryMetadata.class
&& ctx.isMetaDataChanged(typeId, writer.metaDataHashSum())) {
- BinaryMetadataCollector2 metaCollector = new BinaryMetadataCollector2(typeName);
+ BinaryMetadataCollector metaCollector = new BinaryMetadataCollector(typeName);
if (serializer != null)
serializer.writeBinary(obj, metaCollector);
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c84ea3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index e6eb494..117eece 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -110,7 +110,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private final boolean clientNode;
/** */
- private volatile IgniteCacheProxy<PortableMetadataKey2, BinaryMetadata> metaDataCache;
+ private volatile IgniteCacheProxy<PortableMetadataKey, BinaryMetadata> metaDataCache;
/** */
private final ConcurrentHashMap8<Integer, BinaryTypeImpl> clientMetaDataCache;
@@ -120,7 +120,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
private static final long serialVersionUID = 0L;
@Override public boolean apply(GridCacheEntryEx e) {
- return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey2;
+ return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey;
}
};
@@ -238,7 +238,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
GridCacheQueryManager qryMgr = metaDataCache.context().queries();
- CacheQuery<Map.Entry<PortableMetadataKey2, BinaryMetadata>> qry =
+ CacheQuery<Map.Entry<PortableMetadataKey, BinaryMetadata>> qry =
qryMgr.createScanQuery(new MetaDataPredicate(), null, false);
qry.keepAll(false);
@@ -246,9 +246,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
qry.projection(ctx.cluster().get().forNode(oldestSrvNode));
try {
- CacheQueryFuture<Map.Entry<PortableMetadataKey2, BinaryMetadata>> fut = qry.execute();
+ CacheQueryFuture<Map.Entry<PortableMetadataKey, BinaryMetadata>> fut = qry.execute();
- Map.Entry<PortableMetadataKey2, BinaryMetadata> next;
+ Map.Entry<PortableMetadataKey, BinaryMetadata> next;
while ((next = fut.next()) != null) {
assert next.getKey() != null : next;
@@ -294,7 +294,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
* @param key Metadata key.
* @param newMeta Metadata.
*/
- private void addClientCacheMetaData(PortableMetadataKey2 key, final BinaryMetadata newMeta) {
+ private void addClientCacheMetaData(PortableMetadataKey key, final BinaryMetadata newMeta) {
int key0 = key.typeId();
clientMetaDataCache.compute(key0,
@@ -460,7 +460,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
BinaryMetadata newMeta0 = ((BinaryTypeImpl)newMeta).metadata();
- final PortableMetadataKey2 key = new PortableMetadataKey2(typeId);
+ final PortableMetadataKey key = new PortableMetadataKey(typeId);
try {
BinaryMetadata oldMeta = metaDataCache.localPeek(key);
@@ -483,7 +483,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
if (clientNode)
return clientMetaDataCache.get(typeId);
else {
- BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey2(typeId));
+ BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey(typeId));
return meta != null ? meta.wrap(portableCtx) : null;
}
@@ -497,16 +497,16 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
@Override public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds)
throws BinaryObjectException {
try {
- Collection<PortableMetadataKey2> keys = new ArrayList<>(typeIds.size());
+ Collection<PortableMetadataKey> keys = new ArrayList<>(typeIds.size());
for (Integer typeId : typeIds)
- keys.add(new PortableMetadataKey2(typeId));
+ keys.add(new PortableMetadataKey(typeId));
- Map<PortableMetadataKey2, BinaryMetadata> meta = metaDataCache.getAll(keys);
+ Map<PortableMetadataKey, BinaryMetadata> meta = metaDataCache.getAll(keys);
Map<Integer, BinaryType> res = U.newHashMap(meta.size());
- for (Map.Entry<PortableMetadataKey2, BinaryMetadata> e : meta.entrySet())
+ for (Map.Entry<PortableMetadataKey, BinaryMetadata> e : meta.entrySet())
res.put(e.getKey().typeId(), e.getValue().wrap(portableCtx));
return res;
@@ -527,10 +527,10 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
});
else {
return F.viewReadOnly(metaDataCache.entrySetx(metaPred),
- new C1<Cache.Entry<PortableMetadataKey2, BinaryMetadata>, BinaryType>() {
+ new C1<Cache.Entry<PortableMetadataKey, BinaryMetadata>, BinaryType>() {
private static final long serialVersionUID = 0L;
- @Override public BinaryType apply(Cache.Entry<PortableMetadataKey2, BinaryMetadata> e) {
+ @Override public BinaryType apply(Cache.Entry<PortableMetadataKey, BinaryMetadata> e) {
return e.getValue().wrap(portableCtx);
}
});
@@ -799,7 +799,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/**
*/
private static class MetaDataProcessor implements
- EntryProcessor<PortableMetadataKey2, BinaryMetadata, BinaryObjectException>, Externalizable {
+ EntryProcessor<PortableMetadataKey, BinaryMetadata, BinaryObjectException>, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -829,7 +829,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public BinaryObjectException process(
- MutableEntry<PortableMetadataKey2, BinaryMetadata> entry,
+ MutableEntry<PortableMetadataKey, BinaryMetadata> entry,
Object... args) {
try {
BinaryMetadata oldMeta = entry.getValue();
@@ -873,15 +873,15 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/**
*
*/
- class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey2, BinaryMetadata> {
+ class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey, BinaryMetadata> {
/** {@inheritDoc} */
@Override public void onUpdated(
- Iterable<CacheEntryEvent<? extends PortableMetadataKey2, ? extends BinaryMetadata>> evts)
+ Iterable<CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata>> evts)
throws CacheEntryListenerException {
- for (CacheEntryEvent<? extends PortableMetadataKey2, ? extends BinaryMetadata> evt : evts) {
+ for (CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata> evt : evts) {
assert evt.getEventType() == EventType.CREATED || evt.getEventType() == EventType.UPDATED : evt;
- PortableMetadataKey2 key = evt.getKey();
+ PortableMetadataKey key = evt.getKey();
final BinaryMetadata newMeta = evt.getValue();
@@ -906,7 +906,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public boolean evaluate(CacheEntryEvent<?, ?> evt) throws CacheEntryListenerException {
- return evt.getKey() instanceof PortableMetadataKey2;
+ return evt.getKey() instanceof PortableMetadataKey;
}
/** {@inheritDoc} */
@@ -924,7 +924,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public boolean apply(Object key, Object val) {
- return key instanceof PortableMetadataKey2;
+ return key instanceof PortableMetadataKey;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c84ea3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java
new file mode 100644
index 0000000..f838c82
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java
@@ -0,0 +1,82 @@
+/*
+ * 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.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Key for portable meta data.
+ */
+class PortableMetadataKey extends GridCacheUtilityKey<PortableMetadataKey> implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private int typeId;
+
+ /**
+ * For {@link Externalizable}.
+ */
+ public PortableMetadataKey() {
+ // No-op.
+ }
+
+ /**
+ * @param typeId Type ID.
+ */
+ PortableMetadataKey(int typeId) {
+ this.typeId = typeId;
+ }
+
+ /**
+ * @return Type id.
+ */
+ public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(typeId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ typeId = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean equalsx(PortableMetadataKey key) {
+ return typeId == key.typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PortableMetadataKey.class, this);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c84ea3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java
deleted file mode 100644
index 4c99b70..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java
+++ /dev/null
@@ -1,82 +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.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Key for portable meta data.
- */
-class PortableMetadataKey2 extends GridCacheUtilityKey<PortableMetadataKey2> implements Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private int typeId;
-
- /**
- * For {@link Externalizable}.
- */
- public PortableMetadataKey2() {
- // No-op.
- }
-
- /**
- * @param typeId Type ID.
- */
- PortableMetadataKey2(int typeId) {
- this.typeId = typeId;
- }
-
- /**
- * @return Type id.
- */
- public int typeId() {
- return typeId;
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(typeId);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- typeId = in.readInt();
- }
-
- /** {@inheritDoc} */
- @Override protected boolean equalsx(PortableMetadataKey2 key) {
- return typeId == key.typeId;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return typeId;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PortableMetadataKey2.class, this);
- }
-}
\ No newline at end of file
[09/50] [abbrv] ignite git commit: Ignite-1093 Logging & Backward
compatibility failover fixes.
Posted by vo...@apache.org.
Ignite-1093 Logging & Backward compatibility failover fixes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/67f88584
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/67f88584
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/67f88584
Branch: refs/heads/ignite-1816
Commit: 67f88584a4ab330bbda956b3d0d830468d28920f
Parents: 37cafb6
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 10 16:14:15 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 10 16:14:15 2015 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 34 +++++++-------------
.../dht/preloader/GridDhtPartitionDemander.java | 25 ++++++++++++--
2 files changed, 34 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/67f88584/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 479a0b6..5b4fee3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -617,13 +617,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
- * @return {@code True} if topology has changed.
- */
- public boolean topologyChanged() {
- return exchWorker.topologyChanged();
- }
-
- /**
* @param exchFut Exchange future.
* @param reassign Dummy reassign flag.
*/
@@ -673,7 +666,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (log.isDebugEnabled())
log.debug("Refreshing partitions [oldest=" + oldest.id() + ", loc=" + cctx.localNodeId() + ']');
- Collection<ClusterNode> rmts = null;
+ Collection<ClusterNode> rmts;
// If this is the oldest node.
if (oldest.id().equals(cctx.localNodeId())) {
@@ -1362,7 +1355,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (marshR != null || !rebalanceQ.isEmpty()) {
if (futQ.isEmpty()) {
- U.log(log, "Starting caches rebalancing [top=" + exchFut.topologyVersion() + "]");
+ U.log(log, "Rebalancing required" +
+ "[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
+ ", node=" + exchFut.discoveryEvent().node().id() + ']');
if (marshR != null)
try {
@@ -1404,13 +1399,15 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
}, /*system pool*/ true);
}
- else {
- U.log(log, "Obsolete exchange, skipping rebalancing [top=" + exchFut.topologyVersion() + "]");
- }
- }
- else {
- U.log(log, "Nothing scheduled, skipping rebalancing [top=" + exchFut.topologyVersion() + "]");
+ else
+ U.log(log, "Skipping rebalancing (obsolete exchange ID) " +
+ "[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
+ ", node=" + exchFut.discoveryEvent().node().id() + ']');
}
+ else
+ U.log(log, "Skipping rebalancing (nothing scheduled) " +
+ "[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
+ ", node=" + exchFut.discoveryEvent().node().id() + ']');
}
}
catch (IgniteInterruptedCheckedException e) {
@@ -1425,13 +1422,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
}
}
-
- /**
- * @return {@code True} if another exchange future has been queued up.
- */
- boolean topologyChanged() {
- return !futQ.isEmpty() || busy;
- }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/67f88584/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 29ca5f4..40d3dc1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -114,6 +114,10 @@ public class GridDhtPartitionDemander {
@Deprecated//Backward compatibility. To be removed in future.
private final AtomicInteger dmIdx = new AtomicInteger();
+ /** DemandWorker. */
+ @Deprecated//Backward compatibility. To be removed in future.
+ private volatile DemandWorker worker;
+
/** Cached rebalance topics. */
private final Map<Integer, Object> rebalanceTopics;
@@ -166,6 +170,11 @@ public class GridDhtPartitionDemander {
rebalanceFut.onDone(false);
}
+ DemandWorker dw = worker;
+
+ if (dw != null)
+ dw.cancel();
+
lastExchangeFut = null;
lastTimeoutObj.set(null);
@@ -426,9 +435,9 @@ public class GridDhtPartitionDemander {
d.timeout(cctx.config().getRebalanceTimeout());
d.workerId(0);//old api support.
- DemandWorker dw = new DemandWorker(dmIdx.incrementAndGet(), fut);
+ worker = new DemandWorker(dmIdx.incrementAndGet(), fut);
- dw.run(node, d);
+ worker.run(node, d);
}
}
@@ -1137,6 +1146,13 @@ public class GridDhtPartitionDemander {
return TOPIC_CACHE.topic(cctx.namexx(), cctx.nodeId(), id, idx);
}
+ /** */
+ public void cancel() {
+ msgQ.clear();
+
+ msgQ.offer(new SupplyMessage(null, null));
+ }
+
/**
* @param node Node to demand from.
* @param topVer Topology version.
@@ -1159,7 +1175,7 @@ public class GridDhtPartitionDemander {
d.topic(topic(cntr));
d.workerId(id);
- if (topologyChanged(fut))
+ if (fut.isDone() || topologyChanged(fut))
return;
cctx.io().addOrderedHandler(d.topic(), new CI2<UUID, GridDhtPartitionSupplyMessage>() {
@@ -1228,6 +1244,9 @@ public class GridDhtPartitionDemander {
continue; // While.
}
+ if (s.senderId() == null)
+ return; // Stopping now.
+
// Check that message was received from expected node.
if (!s.senderId().equals(node.id())) {
U.warn(log, "Received supply message from unexpected node [expectedId=" + node.id() +