You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/10/03 09:55:32 UTC
[01/30] ignite git commit: Merge branch ignite-1.6.9 into
ignite-1.7.2.
Repository: ignite
Updated Branches:
refs/heads/master e7f353283 -> e7b13cc5c
Merge branch ignite-1.6.9 into ignite-1.7.2.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/53fbad7d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/53fbad7d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/53fbad7d
Branch: refs/heads/master
Commit: 53fbad7ddafdae7b368b0f207d06d16574978d62
Parents: 17c2fc0 daf974d
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Sep 28 17:24:56 2016 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Sep 28 17:24:56 2016 +0700
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgnitionEx.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
[19/30] ignite git commit: ignite-3621 Fixed 'testEvictExpired'.
Posted by pt...@apache.org.
ignite-3621 Fixed 'testEvictExpired'.
(cherry picked from commit a4d7aa3)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ad613afd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ad613afd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ad613afd
Branch: refs/heads/master
Commit: ad613afd7165ed2d8bf0a62805fc2506dfe6c59a
Parents: 062b9b6
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 29 12:04:44 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 29 14:16:31 2016 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheConfigVariationsFullApiTest.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad613afd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index 2ca09c8..6b0e193 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -3336,7 +3336,12 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
boolean wait = waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
- return cache.localPeek(key) == null;
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
}
}, ttl + 1000);
[12/30] ignite git commit: Validate hash code presence in
BinaryObject. Fixes #928
Posted by pt...@apache.org.
Validate hash code presence in BinaryObject. Fixes #928
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e3dfdecc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e3dfdecc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e3dfdecc
Branch: refs/heads/master
Commit: e3dfdecc3607b5f3183bfcb1ce36c57543a8965f
Parents: 78144c4
Author: Alexander Paschenko <al...@gmail.com>
Authored: Wed Sep 28 16:46:46 2016 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Sep 28 17:00:45 2016 +0300
----------------------------------------------------------------------
.../internal/binary/BinaryClassDescriptor.java | 16 ++++-
.../internal/binary/BinaryEnumObjectImpl.java | 5 ++
.../ignite/internal/binary/BinaryObjectEx.java | 8 +++
.../internal/binary/BinaryObjectImpl.java | 7 +++
.../binary/BinaryObjectOffheapImpl.java | 7 +++
.../ignite/internal/binary/BinaryUtils.java | 5 +-
.../internal/binary/BinaryWriterExImpl.java | 6 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 11 +++-
.../processors/cache/GridCacheUtils.java | 5 ++
.../ignite/internal/util/IgniteUtils.java | 23 ++++++-
...ridCacheStoreManagerDeserializationTest.java | 1 +
.../cache/GridCacheUtilsSelfTest.java | 64 +++++++++++++++++++-
...calCacheStoreManagerDeserializationTest.java | 2 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 31 ++++++++++
14 files changed, 182 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 083057d..4c824d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -41,6 +41,7 @@ import org.apache.ignite.binary.BinarySerializer;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -114,6 +115,9 @@ public class BinaryClassDescriptor {
private final boolean excluded;
/** */
+ private final boolean overridesHashCode;
+
+ /** */
private final Class<?>[] intfs;
/**
@@ -164,6 +168,8 @@ public class BinaryClassDescriptor {
this.mapper = mapper;
this.registered = registered;
+ overridesHashCode = IgniteUtils.overridesEqualsAndHashCode(cls);
+
schemaReg = ctx.schemaRegistry(typeId);
excluded = MarshallerExclusions.isExcluded(cls);
@@ -845,7 +851,15 @@ public class BinaryClassDescriptor {
* @param obj Object.
*/
private void postWrite(BinaryWriterExImpl writer, Object obj) {
- writer.postWrite(userType, registered, obj instanceof CacheObjectImpl ? 0 : obj.hashCode());
+ if (obj instanceof CacheObjectImpl)
+ writer.postWrite(userType, registered, 0, false);
+ else if (obj instanceof BinaryObjectEx) {
+ boolean flagSet = ((BinaryObjectEx)obj).isFlagSet(BinaryUtils.FLAG_EMPTY_HASH_CODE);
+
+ writer.postWrite(userType, registered, obj.hashCode(), !flagSet);
+ }
+ else
+ writer.postWrite(userType, registered, obj.hashCode(), overridesHashCode);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index c9874ed..dcfcc9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -139,6 +139,11 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
}
/** {@inheritDoc} */
+ @Override public boolean isFlagSet(short flag) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
@Override public <F> F field(String fieldName) throws BinaryObjectException {
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
index e3566bc..4e137b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
@@ -38,4 +38,12 @@ public interface BinaryObjectEx extends BinaryObject {
* @throws BinaryObjectException If failed.
*/
@Nullable public BinaryType rawType() throws BinaryObjectException;
+
+ /**
+ * Check if flag set.
+ *
+ * @param flag flag to check.
+ * @return {@code true} if flag is set, {@code false} otherwise.
+ */
+ public boolean isFlagSet(short flag);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index 7b42c03..f37d7c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -246,6 +246,13 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
}
/** {@inheritDoc} */
+ @Override public boolean isFlagSet(short flag) {
+ short flags = BinaryPrimitives.readShort(arr, start + GridBinaryMarshaller.FLAGS_POS);
+
+ return BinaryUtils.isFlagSet(flags, flag);
+ }
+
+ /** {@inheritDoc} */
@Override public int typeId() {
int off = start + GridBinaryMarshaller.TYPE_ID_POS;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
index 2225b7a..9cbbaa2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
@@ -145,6 +145,13 @@ public class BinaryObjectOffheapImpl extends BinaryObjectExImpl implements Exter
}
/** {@inheritDoc} */
+ @Override public boolean isFlagSet(short flag) {
+ short flags = BinaryPrimitives.readShort(ptr, start + GridBinaryMarshaller.FLAGS_POS);
+
+ return BinaryUtils.isFlagSet(flags, flag);
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public BinaryType type() throws BinaryObjectException {
return BinaryUtils.typeProxy(ctx, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index b5834a5..25d87ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -109,6 +109,9 @@ public class BinaryUtils {
/** Flag: compact footer, no field IDs. */
public static final short FLAG_COMPACT_FOOTER = 0x0020;
+ /** Flag: no hash code has been set. */
+ public static final short FLAG_EMPTY_HASH_CODE = 0x0040;
+
/** Offset which fits into 1 byte. */
public static final int OFFSET_1 = 1;
@@ -305,7 +308,7 @@ public class BinaryUtils {
* @param flag Flag.
* @return {@code True} if flag is set in flags.
*/
- private static boolean isFlagSet(short flags, short flag) {
+ static boolean isFlagSet(short flags, short flag) {
return (flags & flag) == flag;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
index 1a81819..22b4d1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
@@ -245,8 +245,9 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
* @param userType User type flag.
* @param registered Whether type is registered.
* @param hashCode Hash code.
+ * @param isHashCodeSet Hash code presence flag.
*/
- public void postWrite(boolean userType, boolean registered, int hashCode) {
+ public void postWrite(boolean userType, boolean registered, int hashCode, boolean isHashCodeSet) {
short flags;
boolean useCompactFooter;
@@ -303,6 +304,9 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
}
}
+ if (!isHashCodeSet)
+ flags |= BinaryUtils.FLAG_EMPTY_HASH_CODE;
+
// Actual write.
int retPos = out.position();
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 086da5c..2c76192 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -86,6 +86,9 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
/** */
private int hashCode;
+ /** */
+ private boolean isHashCodeSet;
+
/**
* @param clsName Class name.
* @param ctx Binary context.
@@ -117,7 +120,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
*/
public BinaryObjectBuilderImpl(BinaryObjectImpl obj) {
this(new BinaryBuilderReader(obj), obj.start());
-
+ isHashCodeSet = !obj.isFlagSet(BinaryUtils.FLAG_EMPTY_HASH_CODE);
reader.registerObject(this);
}
@@ -329,7 +332,8 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
reader.position(start + BinaryUtils.length(reader, start));
}
- writer.postWrite(true, registeredType, hashCode);
+ //noinspection NumberEquality
+ writer.postWrite(true, registeredType, hashCode, isHashCodeSet);
// Update metadata if needed.
int schemaId = writer.schemaId();
@@ -408,9 +412,12 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
}
/** {@inheritDoc} */
+ @SuppressWarnings("UnnecessaryBoxing")
@Override public BinaryObjectBuilderImpl hashCode(int hashCode) {
this.hashCode = hashCode;
+ isHashCodeSet = true;
+
return this;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 1a4ffd5..0f4e89b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1170,6 +1170,7 @@ public class GridCacheUtils {
/**
* Validates that cache key object has overridden equals and hashCode methods.
+ * Will also check that a BinaryObject has a hash code set.
*
* @param key Key.
* @throws IllegalArgumentException If equals or hashCode is not implemented.
@@ -1181,6 +1182,10 @@ public class GridCacheUtils {
if (!U.overridesEqualsAndHashCode(key))
throw new IllegalArgumentException("Cache key must override hashCode() and equals() methods: " +
key.getClass().getName());
+
+ if (U.isHashCodeEmpty(key))
+ throw new IllegalArgumentException("Cache key created with BinaryBuilder is missing hash code - " +
+ "please set it explicitly during building by using BinaryBuilder.hashCode(int)");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index cdaeab1..501cdb2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -149,6 +149,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryRawReader;
import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.cluster.ClusterGroupEmptyException;
@@ -170,6 +171,8 @@ import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.binary.BinaryObjectEx;
+import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException;
@@ -8479,9 +8482,15 @@ public abstract class IgniteUtils {
* @return {@code True} if given object has overridden equals and hashCode method.
*/
public static boolean overridesEqualsAndHashCode(Object obj) {
- try {
- Class<?> cls = obj.getClass();
+ return overridesEqualsAndHashCode(obj.getClass());
+ }
+ /**
+ * @param cls Class.
+ * @return {@code True} if given class has overridden equals and hashCode method.
+ */
+ public static boolean overridesEqualsAndHashCode(Class<?> cls) {
+ try {
return !Object.class.equals(cls.getMethod("equals", Object.class).getDeclaringClass()) &&
!Object.class.equals(cls.getMethod("hashCode").getDeclaringClass());
}
@@ -8491,6 +8500,16 @@ public abstract class IgniteUtils {
}
/**
+ * @param obj Object.
+ * @return {@code True} if given object is a {@link BinaryObjectEx} and
+ * has {@link BinaryUtils#FLAG_EMPTY_HASH_CODE} set
+ */
+ public static boolean isHashCodeEmpty(Object obj) {
+ return obj != null && obj instanceof BinaryObjectEx &&
+ ((BinaryObjectEx)obj).isFlagSet(BinaryUtils.FLAG_EMPTY_HASH_CODE);
+ }
+
+ /**
* Checks if error is MAC invalid argument error which ususally requires special handling.
*
* @param e Exception.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
index 4a069a9..39ce33d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
@@ -279,6 +279,7 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
for (int i = 0; i < 1; i++) {
builder.setField("id", i);
+ builder.hashCode(i);
entity = builder.build();
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
index d5888e7..5f2c004 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
@@ -18,7 +18,21 @@
package org.apache.ignite.internal.processors.cache;
import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryCachingMetadataHandler;
+import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.binary.BinaryObjectImpl;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
+import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.logger.NullLogger;
+import org.apache.ignite.marshaller.MarshallerContextTestImpl;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -104,7 +118,8 @@ public class GridCacheUtilsSelfTest extends GridCommonAbstractTest {
/**
*/
- public void testCacheKeyValidation() {
+ @SuppressWarnings("ResultOfMethodCallIgnored")
+ public void testCacheKeyValidation() throws IgniteCheckedException {
CU.validateCacheKey("key");
CU.validateCacheKey(1);
@@ -124,6 +139,53 @@ public class GridCacheUtilsSelfTest extends GridCommonAbstractTest {
assertThrowsForInvalidKey(new NoHashCode());
assertThrowsForInvalidKey(new WrongEquals());
+
+ BinaryObjectBuilderImpl binBuilder = new BinaryObjectBuilderImpl(binaryContext(),
+ EqualsAndHashCode.class.getName());
+
+ assertThrowsForInvalidKey(binBuilder.build());
+
+ binBuilder.hashCode(0xFE12);
+
+ BinaryObject binObj = binBuilder.build();
+
+ CU.validateCacheKey(binObj);
+
+ BinaryObjectBuilderImpl binBuilder2 = new BinaryObjectBuilderImpl((BinaryObjectImpl) binObj);
+
+ CU.validateCacheKey(binBuilder2.build());
+ }
+
+ /**
+ * @return Binary marshaller.
+ * @throws IgniteCheckedException if failed.
+ */
+ private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException {
+ IgniteConfiguration iCfg = new IgniteConfiguration();
+
+ BinaryConfiguration bCfg = new BinaryConfiguration();
+
+ iCfg.setBinaryConfiguration(bCfg);
+
+ BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
+
+ BinaryMarshaller marsh = new BinaryMarshaller();
+
+ marsh.setContext(new MarshallerContextTestImpl(null));
+
+ IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
+
+ return marsh;
+ }
+
+ /**
+ * @return Binary context.
+ * @throws IgniteCheckedException if failed.
+ */
+ private BinaryContext binaryContext() throws IgniteCheckedException {
+ GridBinaryMarshaller impl = U.field(binaryMarshaller(), "impl");
+
+ return impl.context();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
index 827b3cf..b86fe53 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalCacheStoreManagerDeserializationTest.java
@@ -86,7 +86,7 @@ public class GridLocalCacheStoreManagerDeserializationTest extends GridCacheStor
final BinaryObjectBuilder builder = grid.binary().builder("custom_type");
- final BinaryObject entity = builder.setField("id", 0).build();
+ final BinaryObject entity = builder.setField("id", 0).hashCode(0).build();
cache.put(entity, entity);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3dfdecc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index 3a510c3..7936ea4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -28,6 +28,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.Callable;
import javax.cache.Cache;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorException;
@@ -887,6 +888,36 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
}
/**
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings({ "ThrowableResultOfMethodCallIgnored", "unchecked" })
+ public void testPutWithoutHashCode() throws Exception {
+ final IgniteCache c = jcache(0);
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ /** {@inheritDoc} */
+ @Override public Object call() throws Exception {
+ c.put(new TestObject(5), 5);
+ return null;
+ }
+ }, IllegalArgumentException.class, "Cache key must override hashCode() and equals() methods: ");
+
+ BinaryObjectBuilder bldr = grid(0).binary().builder(TestObject.class.getName());
+ bldr.setField("val", 5);
+
+ final BinaryObject binKey = bldr.build();
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ /** {@inheritDoc} */
+ @Override public Object call() throws Exception {
+ c.put(binKey, 5);
+ return null;
+ }
+ }, IllegalArgumentException.class, "Cache key created with BinaryBuilder is missing hash code - " +
+ "please set it explicitly during building by using BinaryBuilder.hashCode(int)");
+ }
+
+ /**
* @throws Exception if failed.
*/
public void testKeepBinaryTxOverwrite() throws Exception {
[14/30] ignite git commit: IGNITE-3191 - Fixed ordering of fields in
binary objects
Posted by pt...@apache.org.
IGNITE-3191 - Fixed ordering of fields in binary objects
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d1e3a78a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d1e3a78a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d1e3a78a
Branch: refs/heads/master
Commit: d1e3a78ae569fa5d5692816db44f2c677e1b8283
Parents: e3dfdec
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Wed Sep 28 17:53:42 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Wed Sep 28 17:53:42 2016 -0700
----------------------------------------------------------------------
.../internal/binary/BinaryClassDescriptor.java | 16 ++--
.../binary/builder/BinaryObjectBuilderImpl.java | 24 ++---
.../binary/BinaryFieldOrderSelfTest.java | 98 ++++++++++++++++++++
.../IgniteBinaryObjectsTestSuite.java | 2 +
4 files changed, 121 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1e3a78a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 4c824d4..276dfe5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -25,7 +25,6 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.sql.Timestamp;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@@ -33,6 +32,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.binary.BinaryObjectException;
@@ -269,10 +269,9 @@ public class BinaryClassDescriptor {
case OBJECT:
// Must not use constructor to honor transient fields semantics.
ctor = null;
- ArrayList<BinaryFieldAccessor> fields0 = new ArrayList<>();
stableFieldsMeta = metaDataEnabled ? new HashMap<String, Integer>() : null;
- BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
+ Map<String, BinaryFieldAccessor> fields0 = new TreeMap<>();
Set<String> duplicates = duplicateFields(cls);
@@ -300,9 +299,7 @@ public class BinaryClassDescriptor {
BinaryFieldAccessor fieldInfo = BinaryFieldAccessor.create(f, fieldId);
- fields0.add(fieldInfo);
-
- schemaBuilder.addField(fieldId);
+ fields0.put(name, fieldInfo);
if (metaDataEnabled)
stableFieldsMeta.put(name, fieldInfo.mode().typeId());
@@ -310,7 +307,12 @@ public class BinaryClassDescriptor {
}
}
- fields = fields0.toArray(new BinaryFieldAccessor[fields0.size()]);
+ fields = fields0.values().toArray(new BinaryFieldAccessor[fields0.size()]);
+
+ BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
+
+ for (BinaryFieldAccessor field : fields)
+ schemaBuilder.addField(field.id);
stableSchema = schemaBuilder.build();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1e3a78a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 2c76192..d166051 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -17,32 +17,32 @@
package org.apache.ignite.internal.binary.builder;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
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.BinaryType;
+import org.apache.ignite.internal.binary.BinaryContext;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryObjectImpl;
-import org.apache.ignite.internal.binary.BinaryWriterExImpl;
-import org.apache.ignite.internal.binary.GridBinaryMarshaller;
-import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
import org.apache.ignite.internal.binary.BinarySchema;
import org.apache.ignite.internal.binary.BinarySchemaRegistry;
-import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.binary.BinaryWriterExImpl;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
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.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
/**
*
*/
@@ -522,7 +522,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
Object val = val0 == null ? new BinaryValueWithType(BinaryUtils.typeByClass(Object.class), null) : val0;
if (assignedVals == null)
- assignedVals = new LinkedHashMap<>();
+ assignedVals = new TreeMap<>();
Object oldVal = assignedVals.put(name, val);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1e3a78a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
new file mode 100644
index 0000000..6bb1e13
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
@@ -0,0 +1,98 @@
+package org.apache.ignite.internal.binary;
+
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test that field ordering doesn't change the schema.
+ */
+public class BinaryFieldOrderSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setMarshaller(new BinaryMarshaller());
+ cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(new TcpDiscoveryVmIpFinder(true)));
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ startGrid();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testEquals() throws Exception {
+ IgniteEx ignite = grid();
+
+ BinaryObject bo0 = ignite.binary().toBinary(new MyType(222, 333, 111));
+
+ BinaryObject bo1 = ignite.binary().builder(bo0.type().typeName()).
+ setField("b", 222).
+ setField("c", 333).
+ setField("a", 111).
+ hashCode(12345).
+ build();
+
+ BinaryObject bo2 = ignite.binary().builder(bo0.type().typeName()).
+ setField("a", 111).
+ setField("b", 222).
+ setField("c", 333).
+ hashCode(12345).
+ build();
+
+ assertEquals(12345, bo0.hashCode());
+ assertEquals(12345, bo1.hashCode());
+ assertEquals(12345, bo2.hashCode());
+
+ assertTrue(bo0.equals(bo1));
+ assertTrue(bo0.equals(bo2));
+ assertTrue(bo1.equals(bo2));
+ }
+
+ /**
+ */
+ private static class MyType {
+ /** B. */
+ private int b;
+
+ /** C. */
+ private int c;
+
+ /** A. */
+ private int a;
+
+ /**
+ * @param b B.
+ * @param c C.
+ * @param a A.
+ */
+ MyType(int b, int c, int a) {
+ this.b = b;
+ this.c = c;
+ this.a = a;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return 12345;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1e3a78a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
index c1d9974..50c6f0b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.binary.BinaryBasicIdMapperSelfTest;
import org.apache.ignite.internal.binary.BinaryBasicNameMapperSelfTest;
import org.apache.ignite.internal.binary.BinaryConfigurationConsistencySelfTest;
import org.apache.ignite.internal.binary.BinaryEnumsSelfTest;
+import org.apache.ignite.internal.binary.BinaryFieldOrderSelfTest;
import org.apache.ignite.internal.binary.BinaryFieldsHeapSelfTest;
import org.apache.ignite.internal.binary.BinaryFieldsOffheapSelfTest;
import org.apache.ignite.internal.binary.BinaryFooterOffsetsHeapSelfTest;
@@ -104,6 +105,7 @@ public class IgniteBinaryObjectsTestSuite extends TestSuite {
suite.addTestSuite(GridBinaryAffinityKeySelfTest.class);
suite.addTestSuite(GridBinaryWildcardsSelfTest.class);
suite.addTestSuite(BinaryObjectToStringSelfTest.class);
+ suite.addTestSuite(BinaryFieldOrderSelfTest.class);
// Tests for objects with non-compact footers.
suite.addTestSuite(BinaryMarshallerNonCompactSelfTest.class);
[22/30] ignite git commit: IGNITE-4007 Fixed update of
QueryMetrics.minimumTime() metric. Tests added. Added Visor reset metrics
task.
Posted by pt...@apache.org.
IGNITE-4007 Fixed update of QueryMetrics.minimumTime() metric. Tests added. Added Visor reset metrics task.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c32082fe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c32082fe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c32082fe
Branch: refs/heads/master
Commit: c32082fe8b1e02758179c1b7bb61a75be53534fe
Parents: f447559
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Sep 30 15:20:11 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Sep 30 15:20:11 2016 +0700
----------------------------------------------------------------------
.../query/GridCacheQueryMetricsAdapter.java | 12 ++--
.../cache/VisorCacheResetQueryMetricsTask.java | 69 ++++++++++++++++++++
.../CacheAbstractQueryMetricsSelfTest.java | 6 +-
3 files changed, 80 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c32082fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
index 1928ea5..e70ea9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
@@ -34,7 +34,7 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
private static final long serialVersionUID = 0L;
/** Minimum time of execution. */
- private final GridAtomicLong minTime = new GridAtomicLong();
+ private final GridAtomicLong minTime = new GridAtomicLong(Long.MAX_VALUE);
/** Maximum time of execution. */
private final GridAtomicLong maxTime = new GridAtomicLong();
@@ -58,7 +58,9 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
/** {@inheritDoc} */
@Override public long minimumTime() {
- return minTime.get();
+ long min = minTime.get();
+
+ return min == Long.MAX_VALUE ? 0 : min;
}
/** {@inheritDoc} */
@@ -71,9 +73,9 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
if (avgTime > 0)
return avgTime;
else {
- long val = completed.sum();
+ double val = completed.sum();
- return val > 0 ? sumTime.sum() / val : 0;
+ return val > 0 ? sumTime.sum() / val : 0.0;
}
}
@@ -170,4 +172,4 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
@Override public String toString() {
return S.toString(GridCacheQueryMetricsAdapter.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c32082fe/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
new file mode 100644
index 0000000..96d9857
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
@@ -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.
+ */
+
+package org.apache.ignite.internal.visor.cache;
+
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * Reset compute grid query metrics.
+ */
+@GridInternal
+public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheResetQueryMetricsJob job(String arg) {
+ return new VisorCacheResetQueryMetricsJob(arg, debug);
+ }
+
+ /**
+ * Job that reset cache query metrics.
+ */
+ private static class VisorCacheResetQueryMetricsJob extends VisorJob<String, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * @param arg Cache name to reset query metrics for.
+ * @param debug Debug flag.
+ */
+ private VisorCacheResetQueryMetricsJob(String arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Void run(String cacheName) {
+ IgniteInternalCache cache = ignite.cachex(cacheName);
+
+ if (cache != null)
+ cache.context().queries().resetMetrics();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheResetQueryMetricsJob.class, this);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c32082fe/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
index d2d8c4d..10f7612 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
@@ -236,6 +236,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
assertTrue(m.averageTime() >= 0);
assertTrue(m.maximumTime() >= 0);
assertTrue(m.minimumTime() >= 0);
+ assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
// Execute again with the same parameters.
cache.query(qry).getAll();
@@ -274,6 +275,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
assertTrue(m.averageTime() >= 0);
assertTrue(m.maximumTime() >= 0);
assertTrue(m.minimumTime() >= 0);
+ assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
// Execute again with the same parameters.
cache.query(qry).iterator().next();
@@ -301,7 +303,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
try {
cache.query(qry).getAll();
}
- catch (Exception e) {
+ catch (Exception ignored) {
// No-op.
}
@@ -320,7 +322,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
try {
cache.query(qry).getAll();
}
- catch (Exception e) {
+ catch (Exception ignored) {
// No-op.
}
[24/30] ignite git commit: Revert "IGNITE-3191 - Fixed ordering of
fields in binary objects"
Posted by pt...@apache.org.
Revert "IGNITE-3191 - Fixed ordering of fields in binary objects"
This reverts commit d1e3a78ae569fa5d5692816db44f2c677e1b8283.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/de50287d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/de50287d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/de50287d
Branch: refs/heads/master
Commit: de50287d493acc73186926d34431733bc76c549b
Parents: f745371
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 3 10:07:33 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 3 10:07:33 2016 +0300
----------------------------------------------------------------------
.../internal/binary/BinaryClassDescriptor.java | 16 ++--
.../binary/builder/BinaryObjectBuilderImpl.java | 24 ++---
.../binary/BinaryFieldOrderSelfTest.java | 98 --------------------
.../IgniteBinaryObjectsTestSuite.java | 2 -
4 files changed, 19 insertions(+), 121 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/de50287d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 276dfe5..4c824d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -25,6 +25,7 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@@ -32,7 +33,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.TreeMap;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.binary.BinaryObjectException;
@@ -269,9 +269,10 @@ public class BinaryClassDescriptor {
case OBJECT:
// Must not use constructor to honor transient fields semantics.
ctor = null;
+ ArrayList<BinaryFieldAccessor> fields0 = new ArrayList<>();
stableFieldsMeta = metaDataEnabled ? new HashMap<String, Integer>() : null;
- Map<String, BinaryFieldAccessor> fields0 = new TreeMap<>();
+ BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
Set<String> duplicates = duplicateFields(cls);
@@ -299,7 +300,9 @@ public class BinaryClassDescriptor {
BinaryFieldAccessor fieldInfo = BinaryFieldAccessor.create(f, fieldId);
- fields0.put(name, fieldInfo);
+ fields0.add(fieldInfo);
+
+ schemaBuilder.addField(fieldId);
if (metaDataEnabled)
stableFieldsMeta.put(name, fieldInfo.mode().typeId());
@@ -307,12 +310,7 @@ public class BinaryClassDescriptor {
}
}
- fields = fields0.values().toArray(new BinaryFieldAccessor[fields0.size()]);
-
- BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
-
- for (BinaryFieldAccessor field : fields)
- schemaBuilder.addField(field.id);
+ fields = fields0.toArray(new BinaryFieldAccessor[fields0.size()]);
stableSchema = schemaBuilder.build();
http://git-wip-us.apache.org/repos/asf/ignite/blob/de50287d/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index d166051..2c76192 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -17,32 +17,32 @@
package org.apache.ignite.internal.binary.builder;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
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.BinaryType;
-import org.apache.ignite.internal.binary.BinaryContext;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryObjectImpl;
-import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
+import org.apache.ignite.internal.binary.BinaryWriterExImpl;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.binary.BinaryContext;
import org.apache.ignite.internal.binary.BinarySchema;
import org.apache.ignite.internal.binary.BinarySchemaRegistry;
+import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
import org.apache.ignite.internal.binary.BinaryUtils;
-import org.apache.ignite.internal.binary.BinaryWriterExImpl;
-import org.apache.ignite.internal.binary.GridBinaryMarshaller;
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.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
/**
*
*/
@@ -522,7 +522,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
Object val = val0 == null ? new BinaryValueWithType(BinaryUtils.typeByClass(Object.class), null) : val0;
if (assignedVals == null)
- assignedVals = new TreeMap<>();
+ assignedVals = new LinkedHashMap<>();
Object oldVal = assignedVals.put(name, val);
http://git-wip-us.apache.org/repos/asf/ignite/blob/de50287d/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
deleted file mode 100644
index 6bb1e13..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.apache.ignite.internal.binary;
-
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Test that field ordering doesn't change the schema.
- */
-public class BinaryFieldOrderSelfTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setMarshaller(new BinaryMarshaller());
- cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(new TcpDiscoveryVmIpFinder(true)));
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startGrid();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testEquals() throws Exception {
- IgniteEx ignite = grid();
-
- BinaryObject bo0 = ignite.binary().toBinary(new MyType(222, 333, 111));
-
- BinaryObject bo1 = ignite.binary().builder(bo0.type().typeName()).
- setField("b", 222).
- setField("c", 333).
- setField("a", 111).
- hashCode(12345).
- build();
-
- BinaryObject bo2 = ignite.binary().builder(bo0.type().typeName()).
- setField("a", 111).
- setField("b", 222).
- setField("c", 333).
- hashCode(12345).
- build();
-
- assertEquals(12345, bo0.hashCode());
- assertEquals(12345, bo1.hashCode());
- assertEquals(12345, bo2.hashCode());
-
- assertTrue(bo0.equals(bo1));
- assertTrue(bo0.equals(bo2));
- assertTrue(bo1.equals(bo2));
- }
-
- /**
- */
- private static class MyType {
- /** B. */
- private int b;
-
- /** C. */
- private int c;
-
- /** A. */
- private int a;
-
- /**
- * @param b B.
- * @param c C.
- * @param a A.
- */
- MyType(int b, int c, int a) {
- this.b = b;
- this.c = c;
- this.a = a;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return super.equals(obj);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return 12345;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de50287d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
index 50c6f0b..c1d9974 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.binary.BinaryBasicIdMapperSelfTest;
import org.apache.ignite.internal.binary.BinaryBasicNameMapperSelfTest;
import org.apache.ignite.internal.binary.BinaryConfigurationConsistencySelfTest;
import org.apache.ignite.internal.binary.BinaryEnumsSelfTest;
-import org.apache.ignite.internal.binary.BinaryFieldOrderSelfTest;
import org.apache.ignite.internal.binary.BinaryFieldsHeapSelfTest;
import org.apache.ignite.internal.binary.BinaryFieldsOffheapSelfTest;
import org.apache.ignite.internal.binary.BinaryFooterOffsetsHeapSelfTest;
@@ -105,7 +104,6 @@ public class IgniteBinaryObjectsTestSuite extends TestSuite {
suite.addTestSuite(GridBinaryAffinityKeySelfTest.class);
suite.addTestSuite(GridBinaryWildcardsSelfTest.class);
suite.addTestSuite(BinaryObjectToStringSelfTest.class);
- suite.addTestSuite(BinaryFieldOrderSelfTest.class);
// Tests for objects with non-compact footers.
suite.addTestSuite(BinaryMarshallerNonCompactSelfTest.class);
[17/30] ignite git commit: IGNITE-3633 - Enforce key validation for
tests.
Posted by pt...@apache.org.
IGNITE-3633 - Enforce key validation for tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/062b9b69
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/062b9b69
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/062b9b69
Branch: refs/heads/master
Commit: 062b9b69aa851d5253dfb7f44066b7d749f1ca12
Parents: 3e8a1c6
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 29 11:26:50 2016 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 29 11:27:43 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheAdapter.java | 7 +++++++
.../cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java | 6 ++++++
2 files changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/062b9b69/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 fe6bb1b..55400ab 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
@@ -4891,6 +4891,13 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
+ * For tests only.
+ */
+ public void forceKeyCheck() {
+ keyCheck = true;
+ }
+
+ /**
* Validates that given cache key has overridden equals and hashCode methods and
* implements {@link Externalizable}.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/062b9b69/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index 7936ea4..150c245 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -894,6 +894,10 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
public void testPutWithoutHashCode() throws Exception {
final IgniteCache c = jcache(0);
+ GridCacheAdapter<Object, Object> cache0 = grid(0).context().cache().internalCache(null);
+
+ cache0.forceKeyCheck();
+
GridTestUtils.assertThrows(log, new Callable<Object>() {
/** {@inheritDoc} */
@Override public Object call() throws Exception {
@@ -907,6 +911,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
final BinaryObject binKey = bldr.build();
+ cache0.forceKeyCheck();
+
GridTestUtils.assertThrows(log, new Callable<Object>() {
/** {@inheritDoc} */
@Override public Object call() throws Exception {
[03/30] ignite git commit: ignite-3621 Fixed 'testEvictExpired'.
Posted by pt...@apache.org.
ignite-3621 Fixed 'testEvictExpired'.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bfe44584
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bfe44584
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bfe44584
Branch: refs/heads/master
Commit: bfe4458448a59542713830f57713b3ac2af08e2b
Parents: 4ff19c2
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 14:31:24 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 14:31:24 2016 +0300
----------------------------------------------------------------------
...heAtomicClientOnlyMultiNodeFullApiSelfTest.java | 17 +++++++++++++++--
...acheAtomicNearOnlyMultiNodeFullApiSelfTest.java | 17 +++++++++++++++--
2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bfe44584/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
index 927ee62..65f780b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
@@ -45,6 +46,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNSWAPPED;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
*
@@ -193,7 +195,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
@Override public void testEvictExpired() throws Exception {
IgniteCache<String, Integer> cache = jcache();
- String key = primaryKeysForCache(cache, 1).get(0);
+ final String key = primaryKeysForCache(cache, 1).get(0);
cache.put(key, 1);
@@ -204,7 +206,18 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
grid(0).cache(null).
withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
- Thread.sleep(ttl + 100);
+ boolean wait = waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
+ }
+ }, ttl + 1000);
+
+ assertTrue("Failed to wait for entry expiration.", wait);
// Expired entry should not be swapped.
cache.localEvict(Collections.singleton(key));
http://git-wip-us.apache.org/repos/asf/ignite/blob/bfe44584/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index 3ce38f3..6542e76 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -29,9 +29,11 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
* Tests NEAR_ONLY cache.
@@ -124,7 +126,7 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
IgniteCache<String, Integer> cache = jcache();
- String key = primaryKeysForCache(cache, 1).get(0);
+ final String key = primaryKeysForCache(cache, 1).get(0);
cache.put(key, 1);
@@ -135,7 +137,18 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
grid(0).cache(null).
withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
- Thread.sleep(ttl + 100);
+ boolean wait = waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
+ }
+ }, ttl + 1000);
+
+ assertTrue("Failed to wait for entry expiration.", wait);
// Expired entry should not be swapped.
cache.localEvict(Collections.singleton(key));
[02/30] ignite git commit: ignite-3621 Fixed 'testEvictExpired'.
Posted by pt...@apache.org.
ignite-3621 Fixed 'testEvictExpired'.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4ff19c20
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4ff19c20
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4ff19c20
Branch: refs/heads/master
Commit: 4ff19c20b169e0373eafc8025a838db8bfc61f27
Parents: 53fbad7
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 13:47:51 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 13:47:51 2016 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4ff19c20/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index f2cf414..b328960 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -3477,9 +3477,16 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+ final Affinity<String> aff = ignite(0).affinity(null);
+
boolean wait = waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
- return cache.localPeek(key) == null;
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
}
}, ttl + 1000);
@@ -3498,8 +3505,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
load(cache, key, true);
- Affinity<String> aff = ignite(0).affinity(null);
-
for (int i = 0; i < gridCount(); i++) {
if (aff.isPrimary(grid(i).cluster().localNode(), key))
assertEquals((Integer)1, peek(jcache(i), key));
[21/30] ignite git commit: ignite-1.6.9 - Fixing tests
Posted by pt...@apache.org.
ignite-1.6.9 - Fixing tests
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f447559e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f447559e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f447559e
Branch: refs/heads/master
Commit: f447559ecba55149452e4e48e2bf44ef1fa1b4d7
Parents: 22dc2c9
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 29 17:10:14 2016 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 29 17:10:14 2016 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtCacheAdapter.java | 12 ------------
.../cache/distributed/near/GridNearCacheAdapter.java | 9 ++-------
2 files changed, 2 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f447559e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 8ced02f..35e6267 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -261,18 +261,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
*/
public abstract GridNearCacheAdapter<K, V> near();
- /** {@inheritDoc} */
- @Override public void forceKeyCheck() {
- if (!keyCheck) {
- super.forceKeyCheck();
-
- GridNearCacheAdapter near = near();
-
- if (near != null)
- near.forceKeyCheck();
- }
- }
-
/**
* @return Partition topology.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/f447559e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 6acf48e..4ddad74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -116,14 +116,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
/** {@inheritDoc} */
@Override public void forceKeyCheck() {
- if (!keyCheck) {
- super.forceKeyCheck();
+ super.forceKeyCheck();
- GridDhtCacheAdapter dht = dht();
-
- if (dht != null)
- dht.forceKeyCheck();
- }
+ dht().forceKeyCheck();
}
/** {@inheritDoc} */
[15/30] ignite git commit: Fixed missing Apache header.
Posted by pt...@apache.org.
Fixed missing Apache header.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b280c3ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b280c3ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b280c3ef
Branch: refs/heads/master
Commit: b280c3efa1eb84c6bc8abbe31ba669b0c24323d8
Parents: d1e3a78
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 29 10:23:54 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 29 10:23:54 2016 +0300
----------------------------------------------------------------------
.../internal/binary/BinaryFieldOrderSelfTest.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b280c3ef/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
index 6bb1e13..e470948 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
@@ -1,3 +1,20 @@
+/*
+ * 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.binary;
import org.apache.ignite.binary.BinaryObject;
[04/30] ignite git commit: IGNITE-3989: Moved failing JTA tests to
ignore module.
Posted by pt...@apache.org.
IGNITE-3989: Moved failing JTA tests to ignore module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b9105df7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b9105df7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b9105df7
Branch: refs/heads/master
Commit: b9105df77cc70b532f94899c754fba47e3e05e9a
Parents: ccfaaf8
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 28 14:53:20 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 28 14:53:20 2016 +0300
----------------------------------------------------------------------
modules/ignored-tests/pom.xml | 75 +++++++++++++++++---
.../testsuites/IgniteIgnoredTestSuite.java | 3 +
...titionedCacheJtaLookupClassNameSelfTest.java | 4 +-
.../ignite/testsuites/IgniteJtaTestSuite.java | 3 +-
4 files changed, 74 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9105df7/modules/ignored-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/pom.xml b/modules/ignored-tests/pom.xml
index 9fdff2c..661e237 100644
--- a/modules/ignored-tests/pom.xml
+++ b/modules/ignored-tests/pom.xml
@@ -35,15 +35,16 @@
<url>http://ignite.apache.org</url>
<dependencies>
+ <!-- Ignite modules. -->
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
+ <artifactId>ignite-aws</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
+ <artifactId>ignite-aws</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
@@ -51,26 +52,27 @@
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-log4j</artifactId>
+ <artifactId>ignite-cloud</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-spring</artifactId>
+ <artifactId>ignite-cloud</artifactId>
<version>${project.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-aws</artifactId>
+ <artifactId>ignite-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-aws</artifactId>
+ <artifactId>ignite-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
@@ -78,13 +80,13 @@
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-cloud</artifactId>
+ <artifactId>ignite-jta</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-cloud</artifactId>
+ <artifactId>ignite-jta</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
@@ -92,6 +94,19 @@
<dependency>
<groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-log4j</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-spring</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
<artifactId>ignite-web</artifactId>
<version>${project.version}</version>
</dependency>
@@ -104,6 +119,21 @@
<scope>test</scope>
</dependency>
+ <!-- 3-rd party dependencies. -->
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <version>1.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.43</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
@@ -117,5 +147,34 @@
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.jotm</groupId>
+ <artifactId>jotm-core</artifactId>
+ <version>2.1.9</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9105df7/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
index 3ab1d7f..97f65c5 100644
--- a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
+++ b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
@@ -40,6 +40,9 @@ public class IgniteIgnoredTestSuite extends TestSuite {
/* --- CLOUDS --- */
suite.addTest(IgniteCloudTestSuite.suite());
+ /* --- JTA --- */
+ suite.addTest(IgniteJtaTestSuite.suite());
+
/* --- WEB SESSIONS --- */
suite.addTest(IgniteWebSessionSelfTestSuite.suite());
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9105df7/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
index 2e322f8..1efbda6 100644
--- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
+++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testsuites.IgniteIgnore;
/**
* Lookup class name based JTA integration test using PARTITIONED cache.
@@ -39,9 +40,8 @@ public class GridPartitionedCacheJtaLookupClassNameSelfTest extends AbstractCach
/**
*
*/
+ @IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-1094", forceFailure = true)
public void testUncompatibleTmLookup() {
- fail("https://issues.apache.org/jira/browse/IGNITE-1094");
-
final IgniteEx ignite = grid(0);
final CacheConfiguration cacheCfg = new CacheConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9105df7/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java b/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java
index 60c20dd..4ae5df0 100644
--- a/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java
+++ b/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.cache.GridReplicatedCacheJtaFactory
import org.apache.ignite.internal.processors.cache.GridReplicatedCacheJtaFactoryUseSyncSelfTest;
import org.apache.ignite.internal.processors.cache.GridReplicatedCacheJtaLookupClassNameSelfTest;
import org.apache.ignite.internal.processors.cache.GridJtaLifecycleAwareSelfTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
/**
* JTA integration tests.
@@ -38,7 +39,7 @@ public class IgniteJtaTestSuite extends TestSuite {
* @throws Exception Thrown in case of the failure.
*/
public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("JTA Integration Test Suite");
+ TestSuite suite = new IgniteTestSuite("JTA Integration Test Suite");
suite.addTestSuite(GridPartitionedCacheJtaFactorySelfTest.class);
suite.addTestSuite(GridReplicatedCacheJtaFactorySelfTest.class);
[06/30] ignite git commit: ignite-2833 Need call 'touch' for cache
entry if it was obtained using 'entryEx'.
Posted by pt...@apache.org.
ignite-2833 Need call 'touch' for cache entry if it was obtained using 'entryEx'.
(cherry picked from commit 17c2fc0)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e3f13455
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e3f13455
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e3f13455
Branch: refs/heads/master
Commit: e3f13455d4273e615727d0410783e3719db98f76
Parents: d595345
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 12:56:17 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 15:43:13 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheTtlManager.java | 32 +++++++++++---------
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
2 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3f13455/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
index 996544f..0f855fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
@@ -129,26 +129,28 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
if (log.isTraceEnabled())
log.trace("Trying to remove expired entry from cache: " + e);
- boolean touch = false;
+ boolean touch = e.ctx.isSwapOrOffheapEnabled();
- GridCacheEntryEx entry = e.ctx.cache().entryEx(e.key);
+ GridCacheEntryEx entry = touch ? e.ctx.cache().entryEx(e.key) : e.ctx.cache().peekEx(e.key);
- while (true) {
- try {
- if (entry.onTtlExpired(obsoleteVer))
- touch = false;
+ if (entry != null) {
+ while (true) {
+ try {
+ if (entry.onTtlExpired(obsoleteVer))
+ touch = false;
- break;
- }
- catch (GridCacheEntryRemovedException e0) {
- entry = entry.context().cache().entryEx(entry.key());
+ break;
+ }
+ catch (GridCacheEntryRemovedException e0) {
+ entry = entry.context().cache().entryEx(entry.key());
- touch = true;
+ touch = true;
+ }
}
- }
- if (touch)
- entry.context().evicts().touch(entry, null);
+ if (touch)
+ entry.context().evicts().touch(entry, null);
+ }
}
}
@@ -216,7 +218,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
private final GridCacheContext ctx;
/** Cache Object Key */
- private final CacheObject key;
+ private final KeyCacheObject key;
/**
* @param entry Cache entry to create wrapper for.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3f13455/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index a31c82e..e7daf2b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4057,7 +4057,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
// Peek will actually remove entry from cache.
assertNull(cache.localPeek(key));
- assert cache.localSize() == 0;
+ assertEquals(0, cache.localSize());
// Clear readers, if any.
cache.remove(key);
[26/30] ignite git commit: Merge branch 'ignite-1.6.9' into
ignite-1.7.3
Posted by pt...@apache.org.
Merge branch 'ignite-1.6.9' into ignite-1.7.3
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/36087cfa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/36087cfa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/36087cfa
Branch: refs/heads/master
Commit: 36087cfa6867d29e7db56cf47e7a87b5aa9b63dc
Parents: b590233 de50287
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 3 10:48:50 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 3 10:48:50 2016 +0300
----------------------------------------------------------------------
.../client/ClientReconnectionSelfTest.java | 4 +-
.../client/router/TcpSslRouterSelfTest.java | 7 +-
.../client/suite/IgniteClientTestSuite.java | 71 +++----
.../internal/binary/BinaryClassDescriptor.java | 16 +-
.../internal/binary/BinaryEnumObjectImpl.java | 5 +
.../ignite/internal/binary/BinaryObjectEx.java | 8 +
.../internal/binary/BinaryObjectImpl.java | 7 +
.../binary/BinaryObjectOffheapImpl.java | 7 +
.../ignite/internal/binary/BinaryUtils.java | 5 +-
.../internal/binary/BinaryWriterExImpl.java | 6 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 11 +-
.../processors/cache/GridCacheAdapter.java | 7 +
.../processors/cache/GridCacheUtils.java | 5 +
.../distributed/near/GridNearCacheAdapter.java | 7 +
.../query/GridCacheQueryMetricsAdapter.java | 12 +-
.../ignite/internal/util/IgniteUtils.java | 23 ++-
.../cache/VisorCacheResetQueryMetricsTask.java | 69 +++++++
...ridCacheStoreManagerDeserializationTest.java | 1 +
.../cache/GridCacheUtilsSelfTest.java | 64 +++++-
...calCacheStoreManagerDeserializationTest.java | 2 +-
...niteCacheExpireAndUpdateConsistencyTest.java | 7 +
.../GridCacheBinaryObjectsAbstractSelfTest.java | 37 ++++
.../ignite/testframework/IgniteTestSuite.java | 203 ++++++++++++++++---
.../testframework/junits/GridAbstractTest.java | 31 ++-
.../apache/ignite/testsuites/IgniteIgnore.java | 2 +-
modules/ignored-tests/pom.xml | 128 +++++++++++-
.../testsuites/IgniteIgnoredTestSuite.java | 9 +
.../CacheAbstractQueryMetricsSelfTest.java | 6 +-
...titionedCacheJtaLookupClassNameSelfTest.java | 4 +-
.../ignite/testsuites/IgniteJtaTestSuite.java | 3 +-
.../p2p/GridP2PUserVersionChangeSelfTest.java | 7 +-
.../testsuites/IgniteResourceSelfTestSuite.java | 11 +-
.../testsuites/IgniteSpringTestSuite.java | 15 +-
33 files changed, 676 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/36087cfa/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/36087cfa/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
----------------------------------------------------------------------
diff --cc modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
index 135714f,fff8108..671d339
--- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
+++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
@@@ -46,10 -46,9 +47,10 @@@ public class IgniteSpringTestSuite exte
* @throws Exception Thrown in case of the failure.
*/
public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("Spring Test Suite");
+ TestSuite suite = new IgniteTestSuite("Spring Test Suite");
suite.addTestSuite(GridSpringBeanSerializationSelfTest.class);
+ suite.addTestSuite(IgniteSpringBeanTest.class);
suite.addTestSuite(GridFactorySelfTest.class);
suite.addTest(IgniteResourceSelfTestSuite.suite());
[16/30] ignite git commit: Added node stop to
IgniteCacheExpireAndUpdateConsistencyTest.
Posted by pt...@apache.org.
Added node stop to IgniteCacheExpireAndUpdateConsistencyTest.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3e8a1c6b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3e8a1c6b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3e8a1c6b
Branch: refs/heads/master
Commit: 3e8a1c6b045c231dbb3c972463000f824386aee9
Parents: b280c3e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 29 11:08:23 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 29 11:08:23 2016 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheExpireAndUpdateConsistencyTest.java | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e8a1c6b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
index 7f54a83..882ed22 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
@@ -97,6 +97,13 @@ public class IgniteCacheExpireAndUpdateConsistencyTest extends GridCommonAbstrac
assertTrue(client.configuration().isClientMode());
}
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
/**
* @throws Exception If failed.
*/
[18/30] ignite git commit: ignite-3621 Fixed 'testEvictExpired'.
Posted by pt...@apache.org.
ignite-3621 Fixed 'testEvictExpired'.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4d7aa34
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4d7aa34
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4d7aa34
Branch: refs/heads/master
Commit: a4d7aa343df23a5e00df11c5080cc1762b187161
Parents: 53229e2
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 29 12:04:44 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 29 12:04:44 2016 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheConfigVariationsFullApiTest.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4d7aa34/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index 2ca09c8..6b0e193 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -3336,7 +3336,12 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
boolean wait = waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
- return cache.localPeek(key) == null;
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
}
}, ttl + 1000);
[07/30] ignite git commit: ignite-3621 Fixed 'testEvictExpired'.
Posted by pt...@apache.org.
ignite-3621 Fixed 'testEvictExpired'.
(cherry picked from commit 4ff19c2)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b2faa339
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b2faa339
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b2faa339
Branch: refs/heads/master
Commit: b2faa339acb2eea24e6dd5e0c21fc3d3d0592ff6
Parents: e3f1345
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 13:47:51 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 15:43:26 2016 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2faa339/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index e7daf2b..52d9a5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -3475,9 +3475,16 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+ final Affinity<String> aff = ignite(0).affinity(null);
+
boolean wait = waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
- return cache.localPeek(key) == null;
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
}
}, ttl + 1000);
@@ -3496,8 +3503,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
load(cache, key, true);
- Affinity<String> aff = ignite(0).affinity(null);
-
for (int i = 0; i < gridCount(); i++) {
if (aff.isPrimary(grid(i).cluster().localNode(), key))
assertEquals((Integer)1, peek(jcache(i), key));
[20/30] ignite git commit: GridNearCacheAdapter,
GridDhtCacheAdapter - test fix
Posted by pt...@apache.org.
GridNearCacheAdapter, GridDhtCacheAdapter - test fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/22dc2c9e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/22dc2c9e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/22dc2c9e
Branch: refs/heads/master
Commit: 22dc2c9e05e5183f838865023c9cb7a8291ac67f
Parents: ad613af
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Sep 29 15:43:20 2016 +0300
Committer: Alexander Paschenko <al...@gmail.com>
Committed: Thu Sep 29 15:43:59 2016 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtCacheAdapter.java | 12 ++++++++++++
.../cache/distributed/near/GridNearCacheAdapter.java | 12 ++++++++++++
2 files changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/22dc2c9e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 35e6267..8ced02f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -261,6 +261,18 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
*/
public abstract GridNearCacheAdapter<K, V> near();
+ /** {@inheritDoc} */
+ @Override public void forceKeyCheck() {
+ if (!keyCheck) {
+ super.forceKeyCheck();
+
+ GridNearCacheAdapter near = near();
+
+ if (near != null)
+ near.forceKeyCheck();
+ }
+ }
+
/**
* @return Partition topology.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/22dc2c9e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index dd66a33..6acf48e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -115,6 +115,18 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
public abstract GridDhtCacheAdapter<K, V> dht();
/** {@inheritDoc} */
+ @Override public void forceKeyCheck() {
+ if (!keyCheck) {
+ super.forceKeyCheck();
+
+ GridDhtCacheAdapter dht = dht();
+
+ if (dht != null)
+ dht.forceKeyCheck();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void onReconnected() {
map = new GridCacheConcurrentMapImpl(
ctx,
[28/30] ignite git commit: IGNITE-1629 .NET: Introduced native
logging facility
Posted by pt...@apache.org.
IGNITE-1629 .NET: Introduced native logging facility
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3c9e254e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3c9e254e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3c9e254e
Branch: refs/heads/master
Commit: 3c9e254ee762dfef0b27b5b95a63502069904d70
Parents: 36087cf
Author: ptupitsyn <pt...@gridgain.com>
Authored: Mon Aug 15 16:40:24 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Oct 3 12:16:08 2016 +0300
----------------------------------------------------------------------
.../logger/platform/PlatformLogger.java | 223 ++++++++++
.../platform/PlatformAbstractBootstrap.java | 18 +-
.../platform/PlatformConfigurationEx.java | 6 +
.../platform/PlatformNoopProcessor.java | 10 +
.../processors/platform/PlatformProcessor.java | 16 +
.../platform/PlatformProcessorImpl.java | 56 +++
.../callback/PlatformCallbackGateway.java | 45 ++
.../callback/PlatformCallbackUtils.java | 20 +
.../cpp/PlatformCppConfigurationEx.java | 6 +
.../dotnet/PlatformDotNetBootstrap.java | 9 +
.../PlatformDotNetConfigurationClosure.java | 11 +-
.../dotnet/PlatformDotNetConfigurationEx.java | 12 +-
.../cpp/jni/include/ignite/jni/exports.h | 2 +
.../platforms/cpp/jni/include/ignite/jni/java.h | 13 +
modules/platforms/cpp/jni/project/vs/module.def | 3 +-
modules/platforms/cpp/jni/src/exports.cpp | 12 +-
modules/platforms/cpp/jni/src/java.cpp | 72 +++-
.../Apache.Ignite.Core.Tests.csproj | 8 +
.../Binary/BinaryStringTest.cs | 26 +-
.../Config/Log/custom-log.xml | 50 +++
.../Config/Log/dotnet-log4j.xml | 143 ++++++
.../IgniteConfigurationSerializerTest.cs | 30 +-
.../Log/CustomLoggerTest.cs | 430 +++++++++++++++++++
.../Log/DefaultLoggerTest.cs | 114 +++++
.../Apache.Ignite.Core.Tests/TestUtils.cs | 26 ++
.../Apache.Ignite.Core.csproj | 6 +-
.../Cache/Configuration/CacheConfiguration.cs | 19 +-
.../Cache/Configuration/QueryEntity.cs | 25 +-
.../Cache/Configuration/QueryField.cs | 19 +-
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 8 +
.../Apache.Ignite.Core/IgniteConfiguration.cs | 88 ++++
.../IgniteConfigurationSection.xsd | 12 +
.../dotnet/Apache.Ignite.Core/Ignition.cs | 39 +-
.../Apache.Ignite.Core/Impl/Binary/JavaTypes.cs | 29 +-
.../Apache.Ignite.Core/Impl/Common/Logger.cs | 37 --
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 9 +
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 6 +-
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 7 +
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 26 +-
.../Apache.Ignite.Core/Impl/Log/JavaLogger.cs | 110 +++++
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 7 +
.../Impl/Unmanaged/UnmanagedCallbackHandlers.cs | 3 +
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 76 +++-
.../Impl/Unmanaged/UnmanagedUtils.cs | 27 +-
.../Apache.Ignite.Core/Log/CategoryLogger.cs | 82 ++++
.../dotnet/Apache.Ignite.Core/Log/ILogger.cs | 51 +++
.../dotnet/Apache.Ignite.Core/Log/LogLevel.cs | 53 +++
.../Apache.Ignite.Core/Log/LoggerExtensions.cs | 320 ++++++++++++++
48 files changed, 2308 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/logger/platform/PlatformLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/logger/platform/PlatformLogger.java b/modules/core/src/main/java/org/apache/ignite/internal/logger/platform/PlatformLogger.java
new file mode 100644
index 0000000..0a0437e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/logger/platform/PlatformLogger.java
@@ -0,0 +1,223 @@
+/*
+ * 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.logger.platform;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.apache.ignite.internal.processors.platform.PlatformNativeException;
+import org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
+import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
+import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
+import org.apache.ignite.internal.util.typedef.X;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
+
+/**
+ * Logger that delegates to platform.
+ */
+public class PlatformLogger implements IgniteLogger {
+ /** */
+ public static final int LVL_TRACE = 0;
+
+ /** */
+ public static final int LVL_DEBUG = 1;
+
+ /** */
+ public static final int LVL_INFO = 2;
+
+ /** */
+ public static final int LVL_WARN = 3;
+
+ /** */
+ public static final int LVL_ERROR = 4;
+
+ /** Callbacks. */
+ private volatile PlatformCallbackGateway gate;
+
+ /** Context. */
+ private volatile PlatformContext ctx;
+
+ /** Category. */
+ private final String category;
+
+ /** Trace flag. */
+ private volatile boolean traceEnabled;
+
+ /** Debug flag. */
+ private volatile boolean debugEnabled;
+
+ /** Info flag. */
+ private volatile boolean infoEnabled;
+
+ /** Quiet flag. */
+ private static final boolean isQuiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
+
+ /**
+ * Ctor.
+ *
+ */
+ public PlatformLogger() {
+ category = null;
+ }
+
+ /**
+ * Ctor.
+ */
+ private PlatformLogger(PlatformCallbackGateway gate, PlatformContext ctx, String category,
+ boolean traceEnabled, boolean debugEnabled, boolean infoEnabled) {
+ this.gate = gate;
+ this.ctx = ctx;
+ this.category = category;
+ this.traceEnabled = traceEnabled;
+ this.debugEnabled = debugEnabled;
+ this.infoEnabled = infoEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger getLogger(Object ctgr) {
+ return new PlatformLogger(gate, ctx, getCategoryString(ctgr), traceEnabled, debugEnabled, infoEnabled);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void trace(String msg) {
+ log(LVL_TRACE, msg, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void debug(String msg) {
+ log(LVL_DEBUG, msg, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void info(String msg) {
+ log(LVL_INFO, msg, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void warning(String msg) {
+ log(LVL_WARN, msg, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void warning(String msg, @Nullable Throwable e) {
+ log(LVL_WARN, msg, e);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void error(String msg) {
+ log(LVL_ERROR, msg, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void error(String msg, @Nullable Throwable e) {
+ log(LVL_ERROR, msg, e);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isTraceEnabled() {
+ return traceEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isDebugEnabled() {
+ return debugEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isInfoEnabled() {
+ return infoEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isQuiet() {
+ return isQuiet;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String fileName() {
+ return null;
+ }
+
+ /**
+ * Sets the gateway.
+ *
+ * @param gate Callback gateway.
+ */
+ public void setGateway(PlatformCallbackGateway gate) {
+ assert gate != null;
+ this.gate = gate;
+
+ // Pre-calculate enabled levels (JNI calls are expensive)
+ traceEnabled = gate.loggerIsLevelEnabled(LVL_TRACE);
+ debugEnabled = gate.loggerIsLevelEnabled(LVL_DEBUG);
+ infoEnabled = gate.loggerIsLevelEnabled(LVL_INFO);
+ }
+
+ /**
+ * Sets the context.
+ *
+ * @param ctx Platform context.
+ */
+ public void setContext(PlatformContext ctx) {
+ assert ctx != null;
+ this.ctx = ctx;
+ }
+
+ /**
+ * Logs the message.
+ *
+ * @param level Log level.
+ * @param msg Message.
+ * @param e Exception.
+ */
+ private void log(int level, String msg, @Nullable Throwable e) {
+ String errorInfo = null;
+
+ if (e != null)
+ errorInfo = X.getFullStackTrace(e);
+
+ PlatformNativeException e0 = X.cause(e, PlatformNativeException.class);
+ if (ctx != null && e0 != null) {
+ try (PlatformMemory mem = ctx.memory().allocate()) {
+ PlatformOutputStream out = mem.output();
+ BinaryRawWriterEx writer = ctx.writer(out);
+ writer.writeObject(e0.cause());
+ out.synchronize();
+
+ gate.loggerLog(level, msg, category, errorInfo, mem.pointer());
+ }
+ }
+ else {
+ gate.loggerLog(level, msg, category, errorInfo, 0);
+ }
+ }
+
+ /**
+ * Gets the category string.
+ *
+ * @param ctgr Category object.
+ * @return Category string.
+ */
+ private static String getCategoryString(Object ctgr) {
+ return ctgr instanceof Class
+ ? ((Class)ctgr).getName()
+ : (ctgr == null ? null : String.valueOf(ctgr));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
index a28677f..8b4eb75 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
@@ -22,7 +22,9 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.memory.PlatformExternalMemory;
+import org.apache.ignite.internal.processors.platform.memory.PlatformInputStream;
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteClosure;
@@ -35,7 +37,11 @@ public abstract class PlatformAbstractBootstrap implements PlatformBootstrap {
/** {@inheritDoc} */
@Override public PlatformProcessor start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx,
long envPtr, long dataPtr) {
- Ignition.setClientMode(new PlatformExternalMemory(null, dataPtr).input().readBoolean());
+ final PlatformInputStream input = new PlatformExternalMemory(null, dataPtr).input();
+
+ Ignition.setClientMode(input.readBoolean());
+
+ processInput(input, cfg);
IgniteConfiguration cfg0 = closure(envPtr).apply(cfg);
@@ -61,4 +67,14 @@ public abstract class PlatformAbstractBootstrap implements PlatformBootstrap {
* @return Closure.
*/
protected abstract IgniteClosure<IgniteConfiguration, IgniteConfiguration> closure(long envPtr);
+
+ /**
+ * Processes any additional input data.
+ *
+ * @param input Input stream.
+ * @param cfg Config.
+ */
+ protected void processInput(PlatformInputStream input, IgniteConfiguration cfg) {
+ // No-op.
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
index b7c8895..97f0866 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.platform;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtension;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
import org.jetbrains.annotations.Nullable;
@@ -52,4 +53,9 @@ public interface PlatformConfigurationEx {
* @return Available cache extensions.
*/
@Nullable public Collection<PlatformCacheExtension> cacheExtensions();
+
+ /**
+ * @return Platform logger.
+ */
+ public PlatformLogger logger();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
index cdf418f..a7b7a8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
@@ -175,4 +175,14 @@ public class PlatformNoopProcessor extends GridProcessorAdapter implements Platf
@Override public PlatformTarget getOrCreateNearCache(@Nullable String cacheName, long memPtr) {
return null;
}
+
+ /** {@inheritDoc} */
+ @Override public boolean loggerIsLevelEnabled(int level) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void loggerLog(int level, String message, String category, String errorInfo) {
+ // No-op.
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
index f0201ef..1d9d3cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
@@ -255,4 +255,20 @@ public interface PlatformProcessor extends GridProcessor {
*/
public PlatformTarget getOrCreateNearCache(@Nullable String cacheName, long memPtr);
+ /**
+ * Gets a value indicating whether Ignite logger has specified level enabled.
+ *
+ * @param level Log level.
+ */
+ public boolean loggerIsLevelEnabled(int level);
+
+ /**
+ * Logs to the Ignite logger.
+ *
+ * @param level Log level.
+ * @param message Message.
+ * @param category Category.
+ * @param errorInfo Error info.
+ */
+ public void loggerLog(int level, String message, String category, String errorInfo);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
index b364c4a..548145e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl;
@@ -128,6 +129,9 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
// Initialize cache extensions (if any).
cacheExts = prepareCacheExtensions(interopCfg.cacheExtensions());
+
+ if (interopCfg.logger() != null)
+ interopCfg.logger().setContext(platformCtx);
}
/** {@inheritDoc} */
@@ -433,6 +437,58 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
return new PlatformCache(platformCtx, cache, false, cacheExts);
}
+ /** {@inheritDoc} */
+ @Override public boolean loggerIsLevelEnabled(int level) {
+ IgniteLogger log = ctx.grid().log();
+
+ switch (level) {
+ case PlatformLogger.LVL_TRACE:
+ return log.isTraceEnabled();
+ case PlatformLogger.LVL_DEBUG:
+ return log.isDebugEnabled();
+ case PlatformLogger.LVL_INFO:
+ return log.isInfoEnabled();
+ case PlatformLogger.LVL_WARN:
+ return true;
+ case PlatformLogger.LVL_ERROR:
+ return true;
+ default:
+ assert false;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void loggerLog(int level, String message, String category, String errorInfo) {
+ IgniteLogger log = ctx.grid().log();
+
+ if (category != null)
+ log = log.getLogger(category);
+
+ Throwable err = errorInfo == null ? null : new IgniteException("Platform error:" + errorInfo);
+
+ switch (level) {
+ case PlatformLogger.LVL_TRACE:
+ log.trace(message);
+ break;
+ case PlatformLogger.LVL_DEBUG:
+ log.debug(message);
+ break;
+ case PlatformLogger.LVL_INFO:
+ log.info(message);
+ break;
+ case PlatformLogger.LVL_WARN:
+ log.warning(message, err);
+ break;
+ case PlatformLogger.LVL_ERROR:
+ log.error(message, err);
+ break;
+ default:
+ assert false;
+ }
+ }
+
/**
* Gets the near cache config.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
index 41d3802..de23242 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
@@ -943,6 +943,44 @@ public class PlatformCallbackGateway {
}
/**
+ * Logs to the platform.
+ *
+ * @param level Log level.
+ * @param message Message.
+ * @param category Category.
+ * @param errorInfo Error info.
+ * @param memPtr Pointer to optional payload (serialized exception).
+ */
+ public void loggerLog(int level, String message, String category, String errorInfo, long memPtr) {
+ if (!tryEnter())
+ return; // Do not lock for logger: this should work during shutdown
+
+ try {
+ PlatformCallbackUtils.loggerLog(envPtr, level, message, category, errorInfo, memPtr);
+ }
+ finally {
+ leave();
+ }
+ }
+
+ /**
+ * Gets a value indicating whether native logger has specified level enabled.
+ *
+ * @param level Log level.
+ */
+ public boolean loggerIsLevelEnabled(int level) {
+ if (!tryEnter())
+ return false; // Do not lock for logger: this should work during shutdown
+
+ try {
+ return PlatformCallbackUtils.loggerIsLevelEnabled(envPtr, level);
+ }
+ finally {
+ leave();
+ }
+ }
+
+ /**
* Kernal stop callback.
*/
public void onStop() {
@@ -1058,6 +1096,13 @@ public class PlatformCallbackGateway {
}
/**
+ * Enter gateway.
+ */
+ protected boolean tryEnter() {
+ return lock.enterBusy();
+ }
+
+ /**
* Leave gateway.
*/
protected void leave() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
index 63c6682..09a7f1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
@@ -553,6 +553,26 @@ public class PlatformCallbackUtils {
static native void consoleWrite(String str, boolean isErr);
/**
+ * Logs to the native logger.
+ *
+ * @param envPtr Environment pointer.
+ * @param level Log level.
+ * @param message Message.
+ * @param category Category.
+ * @param errorInfo Error info.
+ * @param memPtr Pointer to optional payload (serialized exception).
+ */
+ static native void loggerLog(long envPtr, int level, String message, String category, String errorInfo, long memPtr);
+
+ /**
+ * Gets a value indicating whether native logger has specified level enabled.
+ *
+ * @param envPtr Environment pointer.
+ * @param level Log level.
+ */
+ static native boolean loggerIsLevelEnabled(long envPtr, int level);
+
+ /**
* Private constructor.
*/
private PlatformCallbackUtils() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationEx.java
index 931a18e..785c9bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationEx.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.platform.cpp;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.PlatformConfigurationEx;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtension;
import org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
@@ -80,6 +81,11 @@ public class PlatformCppConfigurationEx extends PlatformCppConfiguration impleme
return null;
}
+ /** {@inheritDoc} */
+ @Override public PlatformLogger logger() {
+ return null;
+ }
+
/**
* @param warnings Warnings.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
index 9278246..84a4577 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
@@ -17,8 +17,11 @@
package org.apache.ignite.internal.processors.platform.dotnet;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap;
import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure;
+import org.apache.ignite.internal.processors.platform.memory.PlatformInputStream;
import java.io.PrintStream;
@@ -40,4 +43,10 @@ public class PlatformDotNetBootstrap extends PlatformAbstractBootstrap {
@Override protected PlatformAbstractConfigurationClosure closure(long envPtr) {
return new PlatformDotNetConfigurationClosure(envPtr);
}
+
+ /** {@inheritDoc} */
+ @Override protected void processInput(PlatformInputStream input, IgniteConfiguration cfg) {
+ if (input.readBoolean())
+ cfg.setGridLogger(new PlatformLogger());
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/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 cb9696c..0c691af 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
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.binary.BinaryReaderExImpl;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
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.PlatformMemory;
@@ -89,7 +90,15 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
memMgr = new PlatformMemoryManagerImpl(gate, 1024);
- PlatformDotNetConfigurationEx dotNetCfg0 = new PlatformDotNetConfigurationEx(dotNetCfg, gate, memMgr);
+ PlatformLogger userLogger = null;
+
+ if (igniteCfg.getGridLogger() instanceof PlatformLogger) {
+ userLogger = (PlatformLogger)igniteCfg.getGridLogger();
+ userLogger.setGateway(gate);
+ }
+
+ PlatformDotNetConfigurationEx dotNetCfg0 = new PlatformDotNetConfigurationEx(dotNetCfg, gate, memMgr,
+ userLogger);
igniteCfg.setPlatformConfiguration(dotNetCfg0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
index 78fb755..eded0e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.platform.dotnet;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.PlatformConfigurationEx;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtension;
import org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
@@ -39,6 +40,9 @@ public class PlatformDotNetConfigurationEx extends PlatformDotNetConfiguration i
/** Memory manager. */
private final PlatformMemoryManagerImpl memMgr;
+ /** Logger. */
+ private final PlatformLogger logger;
+
/** Warnings */
private Collection<String> warnings;
@@ -50,11 +54,12 @@ public class PlatformDotNetConfigurationEx extends PlatformDotNetConfiguration i
* @param memMgr Memory manager.
*/
public PlatformDotNetConfigurationEx(PlatformDotNetConfiguration cfg, PlatformCallbackGateway gate,
- PlatformMemoryManagerImpl memMgr) {
+ PlatformMemoryManagerImpl memMgr, PlatformLogger logger) {
super(cfg);
this.gate = gate;
this.memMgr = memMgr;
+ this.logger = logger;
}
/** {@inheritDoc} */
@@ -82,6 +87,11 @@ public class PlatformDotNetConfigurationEx extends PlatformDotNetConfiguration i
return Collections.<PlatformCacheExtension>singleton(new PlatformDotNetSessionCacheExtension());
}
+ /** {@inheritDoc} */
+ @Override public PlatformLogger logger() {
+ return logger;
+ }
+
/**
* @param warnings Warnings.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index 3f400fb..7fae0d2 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -54,6 +54,8 @@ extern "C" {
void* IGNITE_CALL IgniteProcessorAtomicReference(gcj::JniContext* ctx, void* obj, char* name, long long memPtr, bool create);
void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long long memPtr);
void IGNITE_CALL IgniteProcessorGetCacheNames(gcj::JniContext* ctx, void* obj, long long memPtr);
+ bool IGNITE_CALL IgniteProcessorLoggerIsLevelEnabled(gcj::JniContext* ctx, void* obj, int level);
+ void IGNITE_CALL IgniteProcessorLoggerLog(gcj::JniContext* ctx, void* obj, int level, char* message, char* category, char* errorInfo);
long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index 8d79a7d..4cf00a3 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -108,6 +108,9 @@ namespace ignite
typedef void(JNICALL *ConsoleWriteHandler)(const char* chars, int charsLen, unsigned char isErr);
+ typedef void(JNICALL *LoggerLogHandler)(void* target, int level, const char* messageChars, int messageCharsLen, const char* categoryChars, int categoryCharsLen, const char* errorInfoChars, int errorInfoCharsLen, long long memPtr);
+ typedef bool(JNICALL *LoggerIsLevelEnabledHandler)(void* target, int level);
+
/**
* JNI handlers holder.
*/
@@ -191,6 +194,9 @@ namespace ignite
AffinityFunctionAssignPartitionsHandler affinityFunctionAssignPartitions;
AffinityFunctionRemoveNodeHandler affinityFunctionRemoveNode;
AffinityFunctionDestroyHandler affinityFunctionDestroy;
+
+ LoggerLogHandler loggerLog;
+ LoggerIsLevelEnabledHandler loggerIsLevelEnabled;
};
/**
@@ -335,6 +341,8 @@ namespace ignite
jmethodID m_PlatformProcessor_getCacheNames;
jmethodID m_PlatformProcessor_atomicSequence;
jmethodID m_PlatformProcessor_atomicReference;
+ jmethodID m_PlatformProcessor_loggerIsLevelEnabled;
+ jmethodID m_PlatformProcessor_loggerLog;
jclass c_PlatformTarget;
jmethodID m_PlatformTarget_inStreamOutLong;
@@ -554,6 +562,8 @@ namespace ignite
jobject ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create);
void ProcessorGetIgniteConfiguration(jobject obj, long long memPtr);
void ProcessorGetCacheNames(jobject obj, long long memPtr);
+ bool ProcessorLoggerIsLevelEnabled(jobject obj, int level);
+ void ProcessorLoggerLog(jobject obj, int level, char* message, char* category, char* errorInfo);
long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
@@ -767,6 +777,9 @@ namespace ignite
JNIEXPORT void JNICALL JniAffinityFunctionDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr);
JNIEXPORT void JNICALL JniConsoleWrite(JNIEnv *env, jclass cls, jstring str, jboolean isErr);
+
+ JNIEXPORT void JNICALL JniLoggerLog(JNIEnv *env, jclass cls, jlong envPtr, jint level, jstring message, jstring category, jstring errorInfo, jlong memPtr);
+ JNIEXPORT jboolean JNICALL JniLoggerIsLevelEnabled(JNIEnv *env, jclass cls, jlong envPtr, jint level);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index ddddace..c1582e6 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -136,4 +136,5 @@ IgniteProcessorGetCacheNames @133
IgniteProjectionForServers @134
IgniteSetConsoleHandler @135
IgniteRemoveConsoleHandler @136
-
\ No newline at end of file
+IgniteProcessorLoggerIsLevelEnabled @137
+IgniteProcessorLoggerLog @138
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index 2950d15..8ef8188 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -93,11 +93,11 @@ extern "C" {
void*IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable) {
return ctx->ProcessorDataStreamer(static_cast<jobject>(obj), name, keepPortable);
}
-
+
void* IGNITE_CALL IgniteProcessorTransactions(gcj::JniContext* ctx, void* obj) {
return ctx->ProcessorTransactions(static_cast<jobject>(obj));
}
-
+
void* IGNITE_CALL IgniteProcessorCompute(gcj::JniContext* ctx, void* obj, void* prj) {
return ctx->ProcessorCompute(static_cast<jobject>(obj), static_cast<jobject>(prj));
}
@@ -138,6 +138,14 @@ extern "C" {
return ctx->ProcessorGetCacheNames(static_cast<jobject>(obj), memPtr);
}
+ bool IGNITE_CALL IgniteProcessorLoggerIsLevelEnabled(gcj::JniContext* ctx, void* obj, int level) {
+ return ctx->ProcessorLoggerIsLevelEnabled(static_cast<jobject>(obj), level);
+ }
+
+ void IGNITE_CALL IgniteProcessorLoggerLog(gcj::JniContext* ctx, void* obj, int level, char* message, char* category, char* errorInfo) {
+ ctx->ProcessorLoggerLog(static_cast<jobject>(obj), level, message, category, errorInfo);
+ }
+
long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
return ctx->TargetInStreamOutLong(static_cast<jobject>(obj), opType, memPtr);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 7bd6287..eb0d89a 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -216,6 +216,8 @@ namespace ignite
JniMethod M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE = JniMethod("atomicReference", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
JniMethod M_PLATFORM_PROCESSOR_GET_IGNITE_CONFIGURATION = JniMethod("getIgniteConfiguration", "(J)V", false);
JniMethod M_PLATFORM_PROCESSOR_GET_CACHE_NAMES = JniMethod("getCacheNames", "(J)V", false);
+ JniMethod M_PLATFORM_PROCESSOR_LOGGER_IS_LEVEL_ENABLED = JniMethod("loggerIsLevelEnabled", "(I)Z", false);
+ JniMethod M_PLATFORM_PROCESSOR_LOGGER_LOG = JniMethod("loggerLog", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", false);
const char* C_PLATFORM_TARGET = "org/apache/ignite/internal/processors/platform/PlatformTarget";
JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_LONG = JniMethod("inStreamOutLong", "(IJ)J", false);
@@ -366,6 +368,9 @@ namespace ignite
JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_DISCONNECTED = JniMethod("onClientDisconnected", "(J)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_RECONNECTED = JniMethod("onClientReconnected", "(JZ)V", true);
+ JniMethod M_PLATFORM_CALLBACK_UTILS_LOGGER_LOG = JniMethod("loggerLog", "(JILjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V", true);
+ JniMethod M_PLATFORM_CALLBACK_UTILS_LOGGER_IS_LEVEL_ENABLED = JniMethod("loggerIsLevelEnabled", "(JI)Z", true);
+
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_INIT = JniMethod("affinityFunctionInit", "(JJLorg/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget;)J", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_PARTITION = JniMethod("affinityFunctionPartition", "(JJJ)I", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_ASSIGN_PARTITIONS = JniMethod("affinityFunctionAssignPartitions", "(JJJJ)V", true);
@@ -716,6 +721,8 @@ namespace ignite
m_PlatformProcessor_atomicReference = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE);
m_PlatformProcessor_getIgniteConfiguration = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_IGNITE_CONFIGURATION);
m_PlatformProcessor_getCacheNames = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_CACHE_NAMES);
+ m_PlatformProcessor_loggerIsLevelEnabled = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_LOGGER_IS_LEVEL_ENABLED);
+ m_PlatformProcessor_loggerLog = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_LOGGER_LOG);
c_PlatformTarget = FindClass(env, C_PLATFORM_TARGET);
m_PlatformTarget_inStreamOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_LONG);
@@ -851,7 +858,7 @@ namespace ignite
void RegisterNatives(JNIEnv* env) {
{
- JNINativeMethod methods[60];
+ JNINativeMethod methods[62];
int idx = 0;
@@ -935,6 +942,9 @@ namespace ignite
AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_DESTROY, reinterpret_cast<void*>(JniAffinityFunctionDestroy));
AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CONSOLE_WRITE, reinterpret_cast<void*>(JniConsoleWrite));
+ AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_LOGGER_LOG, reinterpret_cast<void*>(JniLoggerLog));
+ AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_LOGGER_IS_LEVEL_ENABLED, reinterpret_cast<void*>(JniLoggerIsLevelEnabled));
+
jint res = env->RegisterNatives(FindClass(env, C_PLATFORM_CALLBACK_UTILS), methods, idx);
if (res != JNI_OK)
@@ -1526,6 +1536,40 @@ namespace ignite
ExceptionCheck(env);
}
+ bool JniContext::ProcessorLoggerIsLevelEnabled(jobject obj, int level)
+ {
+ JNIEnv* env = Attach();
+
+ jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformProcessor_loggerIsLevelEnabled, level);
+
+ ExceptionCheck(env);
+
+ return res != 0;
+ }
+
+ void JniContext::ProcessorLoggerLog(jobject obj, int level, char* message, char* category, char* errorInfo)
+ {
+ JNIEnv* env = Attach();
+
+ jstring message0 = message != NULL ? env->NewStringUTF(message) : NULL;
+ jstring category0 = category != NULL ? env->NewStringUTF(category) : NULL;
+ jstring errorInfo0 = errorInfo != NULL ? env->NewStringUTF(errorInfo) : NULL;
+
+
+ env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_loggerLog, level, message0, category0, errorInfo0);
+
+ if (message0)
+ env->DeleteLocalRef(message0);
+
+ if (category0)
+ env->DeleteLocalRef(category0);
+
+ if (errorInfo0)
+ env->DeleteLocalRef(errorInfo0);
+
+ ExceptionCheck(env);
+ }
+
long long JniContext::TargetInStreamOutLong(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
JNIEnv* env = Attach();
@@ -2952,6 +2996,32 @@ namespace ignite
CONSOLE_LOCK.Leave();
}
+
+ JNIEXPORT void JNICALL JniLoggerLog(JNIEnv *env, jclass cls, jlong envPtr, jint level, jstring message, jstring category, jstring errorInfo, jlong memPtr) {
+ int messageLen;
+ char* messageChars = StringToChars(env, message, &messageLen);
+
+ int categoryLen;
+ char* categoryChars = StringToChars(env, category, &categoryLen);
+
+ int errorInfoLen;
+ char* errorInfoChars = StringToChars(env, errorInfo, &errorInfoLen);
+
+ IGNITE_SAFE_PROC(env, envPtr, LoggerLogHandler, loggerLog, level, messageChars, messageLen, categoryChars, categoryLen, errorInfoChars, errorInfoLen, memPtr);
+
+ if (messageChars)
+ delete[] messageChars;
+
+ if (categoryChars)
+ delete[] categoryChars;
+
+ if (errorInfoChars)
+ delete[] errorInfoChars;
+ }
+
+ JNIEXPORT jboolean JNICALL JniLoggerIsLevelEnabled(JNIEnv *env, jclass cls, jlong envPtr, jint level) {
+ IGNITE_SAFE_FUNC(env, envPtr, LoggerIsLevelEnabledHandler, loggerIsLevelEnabled, level);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/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 b1e0dbe..2c6150c 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
@@ -53,6 +53,7 @@
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Log\DefaultLoggerTest.cs" />
<Compile Include="TestAppConfig.cs" />
<Compile Include="Binary\BinaryBuilderSelfTestFullFooter.cs" />
<Compile Include="Binary\BinaryCompactFooterInteropTest.cs" />
@@ -135,6 +136,7 @@
<Compile Include="LifecycleTest.cs" />
<Compile Include="LoadDllTest.cs" />
<Compile Include="IgniteManagerTest.cs" />
+ <Compile Include="Log\CustomLoggerTest.cs" />
<Compile Include="MarshallerTest.cs" />
<Compile Include="MessagingTest.cs" />
<Compile Include="BinaryConfigurationTest.cs" />
@@ -241,6 +243,12 @@
<Content Include="Config\Lifecycle\lifecycle-no-beans.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="Config\Log\dotnet-log4j.xml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Config\Log\custom-log.xml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="Config\spring-test.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStringTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStringTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStringTest.cs
index 0c1f0f3..0593af7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStringTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStringTest.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.Core.Tests.Binary
{
using System;
- using System.Diagnostics;
using Apache.Ignite.Core.Impl.Binary;
using NUnit.Framework;
@@ -83,29 +82,10 @@ namespace Apache.Ignite.Core.Tests.Binary
[Test]
public void TestNewMode()
{
- // Run "TestNewMode" in a separate process
- var envVar = BinaryUtils.IgniteBinaryMarshallerUseStringSerializationVer2;
+ // Run "TestOldMode" in a separate process with changed setting.
+ Environment.SetEnvironmentVariable(BinaryUtils.IgniteBinaryMarshallerUseStringSerializationVer2, "true");
- Environment.SetEnvironmentVariable(envVar, "true");
-
- var procStart = new ProcessStartInfo
- {
- FileName = GetType().Assembly.Location,
- Arguments = GetType().FullName + " TestOldMode",
- CreateNoWindow = true,
- UseShellExecute = false,
- RedirectStandardOutput = true,
- RedirectStandardError = true
- };
-
- var proc = Process.Start(procStart);
-
- Assert.IsNotNull(proc);
-
- Console.WriteLine(proc.StandardOutput.ReadToEnd());
- Console.WriteLine(proc.StandardError.ReadToEnd());
- Assert.IsTrue(proc.WaitForExit(15000));
- Assert.AreEqual(0, proc.ExitCode);
+ TestUtils.RunTestInNewProcess(GetType().FullName, "TestOldMode");
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/custom-log.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/custom-log.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/custom-log.xml
new file mode 100644
index 0000000..5d7dc65
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/custom-log.xml
@@ -0,0 +1,50 @@
+<?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="gridLogger">
+ <bean class="org.apache.ignite.logger.log4j.Log4JLogger">
+ <constructor-arg type="java.lang.String" value="config\log\dotnet-log4j.xml"/>
+ </bean>
+ </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</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ <property name="socketTimeout" value="300" />
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
new file mode 100644
index 0000000..c8c62d7
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
@@ -0,0 +1,143 @@
+<?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.
+-->
+
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
+ "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<!--
+ Default log4j configuration for Ignite.
+-->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+ <!--
+ Logs System.out messages to console.
+ -->
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <!-- Log to STDOUT. -->
+ <param name="Target" value="System.out"/>
+
+ <!-- Log from DEBUG and higher. -->
+ <param name="Threshold" value="DEBUG"/>
+
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{dd-MM-yyyy HH:mm:ss}][%-5p][%t][%c{1}] %m%n"/>
+ </layout>
+
+ <!-- Do not log beyond INFO level. -->
+ <filter class="org.apache.log4j.varia.LevelRangeFilter">
+ <param name="levelMin" value="DEBUG"/>
+ <param name="levelMax" value="INFO"/>
+ </filter>
+ </appender>
+
+ <!--
+ Logs all System.err messages to console.
+ -->
+ <appender name="CONSOLE_ERR" class="org.apache.log4j.ConsoleAppender">
+ <!-- Log to STDERR. -->
+ <param name="Target" value="System.err"/>
+
+ <!-- Log from WARN and higher. -->
+ <param name="Threshold" value="WARN"/>
+
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{dd-MMM-yyyy HH:mm:ss}][%-5p][%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!--
+ Logs all output to specified file.
+ By default, the logging goes to IGNITE_HOME/work/log folder
+
+ Note, this appender is disabled by default.
+ To enable, uncomment the section below and also FILE appender in the <root> element.
+ -->
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="Threshold" value="DEBUG"/>
+ <param name="File" value="${IGNITE_HOME}/work/log/dotnet-logger-test.log"/>
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="10"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!--
+ Uncomment to enable Ignite debugging.
+ -->
+ <!--
+ <category name="org.apache.ignite">
+ <level value="DEBUG"/>
+ </category>
+ -->
+
+ <!--
+ Uncomment this category to enable cache
+ query execution tracing.
+ -->
+ <!--
+ <category name="org.apache.ignite.cache.queries">
+ <level value="DEBUG"/>
+ </category>
+ -->
+
+ <!--
+ Uncomment to enable DGC tracing.
+ -->
+ <!--
+ <category name="org.apache.ignite.grid.kernal.processors.cache.GridCacheDgcManager.trace">
+ <level value="DEBUG"/>
+ </category>
+ -->
+
+ <!--
+ Uncomment to disable courtesy notice.
+ -->
+ <!--
+ <category name="org.apache.ignite.CourtesyConfigNotice">
+ <level value="OFF"/>
+ </category>
+ -->
+
+ <category name="org.springframework">
+ <level value="WARN"/>
+ </category>
+
+ <category name="org.eclipse.jetty">
+ <level value="FATAL"/>
+ </category>
+
+ <category name="com.amazonaws">
+ <level value="WARN"/>
+ </category>
+
+ <!-- Default settings. -->
+ <root>
+ <!-- Print out all info by default. -->
+ <level value="DEBUG"/>
+
+ <!-- Append to console. -->
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="CONSOLE_ERR"/>
+
+ <!-- Uncomment to enable logging to a file. -->
+ <appender-ref ref="FILE"/>
+ </root>
+</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index e8e8f5d..beb1e8d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -43,6 +43,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Lifecycle;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Tests.Binary;
using Apache.Ignite.Core.Transactions;
using NUnit.Framework;
@@ -109,6 +110,7 @@ namespace Apache.Ignite.Core.Tests
<userAttributes><pair key='myNode' value='true' /></userAttributes>
<atomicConfiguration backups='2' cacheMode='Local' atomicSequenceReserveSize='250' />
<transactionConfiguration defaultTransactionConcurrency='Optimistic' defaultTransactionIsolation='RepeatableRead' defaultTimeout='0:1:2' pessimisticTransactionLogSize='15' pessimisticTransactionLogLinger='0:0:33' />
+ <logger type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+TestLogger, Apache.Ignite.Core.Tests' />
</igniteConfig>";
var reader = XmlReader.Create(new StringReader(xml));
@@ -193,6 +195,8 @@ namespace Apache.Ignite.Core.Tests
Assert.IsNotNull(comm);
Assert.AreEqual(33, comm.AckSendThreshold);
Assert.AreEqual(new TimeSpan(0, 1, 2), comm.IdleConnectionTimeout);
+
+ Assert.IsInstanceOf<TestLogger>(cfg.Logger);
}
/// <summary>
@@ -253,7 +257,7 @@ namespace Apache.Ignite.Core.Tests
{
var document = new XmlDocument();
- document.Schemas.Add("http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection",
+ document.Schemas.Add("http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection",
XmlReader.Create("IgniteConfigurationSection.xsd"));
document.Load(new StringReader(xml));
@@ -542,7 +546,10 @@ namespace Apache.Ignite.Core.Tests
SlowClientQueueLimit = 98,
SocketSendBufferSize = 2045,
UnacknowledgedMessagesBufferSize = 3450
- }
+ },
+ IsLateAffinityAssignment = false,
+ SpringConfigUrl = "test",
+ Logger = new TestLogger()
};
}
@@ -688,5 +695,24 @@ namespace Apache.Ignite.Core.Tests
return null;
}
}
+
+ /// <summary>
+ /// Test logger.
+ /// </summary>
+ public class TestLogger : ILogger
+ {
+ /** <inheritdoc /> */
+ public void Log(LogLevel level, string message, object[] args, IFormatProvider formatProvider, string category,
+ string nativeErrorInfo, Exception ex)
+ {
+ throw new NotImplementedException();
+ }
+
+ /** <inheritdoc /> */
+ public bool IsEnabled(LogLevel level)
+ {
+ throw new NotImplementedException();
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
new file mode 100644
index 0000000..73134fe
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
@@ -0,0 +1,430 @@
+\ufeff/*
+ * 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.Log
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Lifecycle;
+ using Apache.Ignite.Core.Log;
+ using Apache.Ignite.Core.Resource;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that user-defined logger receives Ignite events.
+ /// </summary>
+ public class CustomLoggerTest
+ {
+ /** */
+ private static readonly LogLevel[] AllLevels = Enum.GetValues(typeof (LogLevel)).OfType<LogLevel>().ToArray();
+
+ /// <summary>
+ /// Test setup.
+ /// </summary>
+ [SetUp]
+ public void TestSetUp()
+ {
+ TestLogger.Entries.Clear();
+ }
+
+ /// <summary>
+ /// Tests the startup output.
+ /// </summary>
+ [Test]
+ public void TestStartupOutput()
+ {
+ var cfg = GetConfigWithLogger(true);
+ using (var ignite = Ignition.Start(cfg))
+ {
+ // Check injection
+ Assert.AreEqual(((Ignite) ignite).Proxy, ((TestLogger) cfg.Logger).Ignite);
+
+ // Check initial message
+ Assert.IsTrue(TestLogger.Entries[0].Message.StartsWith("Starting Ignite.NET"));
+
+ // Check topology message
+ Assert.IsTrue(
+ TestUtils.WaitForCondition(() =>
+ {
+ lock (TestLogger.Entries)
+ {
+ return TestLogger.Entries.Any(x => x.Message.Contains("Topology snapshot"));
+ }
+ }, 9000), "No topology snapshot");
+ }
+
+ // Test that all levels are present
+ foreach (var level in AllLevels.Where(x => x != LogLevel.Error))
+ Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == level), "No messages with level " + level);
+ }
+
+
+ /// <summary>
+ /// Tests startup error in Java.
+ /// </summary>
+ [Test]
+ public void TestStartupJavaError()
+ {
+ // Invalid config
+ Assert.Throws<IgniteException>(() =>
+ Ignition.Start(new IgniteConfiguration(GetConfigWithLogger())
+ {
+ CommunicationSpi = new TcpCommunicationSpi
+ {
+ IdleConnectionTimeout = TimeSpan.MinValue
+ }
+ }));
+
+ var err = TestLogger.Entries.First(x => x.Level == LogLevel.Error);
+ Assert.IsTrue(err.NativeErrorInfo.Contains("SPI parameter failed condition check: idleConnTimeout > 0"));
+ Assert.AreEqual("org.apache.ignite.internal.IgniteKernal", err.Category);
+ Assert.IsNull(err.Exception);
+ }
+
+ /// <summary>
+ /// Tests startup error in .NET.
+ /// </summary>
+ [Test]
+ public void TestStartupDotNetError()
+ {
+ // Invalid bean
+ Assert.Throws<IgniteException>(() =>
+ Ignition.Start(new IgniteConfiguration(GetConfigWithLogger())
+ {
+ LifecycleBeans = new[] {new FailBean()}
+ }));
+
+ var err = TestLogger.Entries.First(x => x.Level == LogLevel.Error);
+ Assert.IsInstanceOf<ArithmeticException>(err.Exception);
+ }
+
+ /// <summary>
+ /// Tests that .NET exception propagates through Java to the log.
+ /// </summary>
+ [Test]
+ public void TestDotNetErrorPropagation()
+ {
+ // Start 2 nodes: PlatformNativeException does not occur in local scenario
+ using (var ignite = Ignition.Start(GetConfigWithLogger()))
+ using (Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) {GridName = "1"}))
+ {
+ var compute = ignite.GetCluster().ForRemotes().GetCompute();
+
+ Assert.Throws<ArithmeticException>(() => compute.Call(new FailFunc()));
+
+ // Log updates may not arrive immediately
+ TestUtils.WaitForCondition(() => TestLogger.Entries.Any(x => x.Exception != null), 3000);
+
+ var errFromJava = TestLogger.Entries.Single(x => x.Exception != null);
+ Assert.AreEqual("Error in func.", ((ArithmeticException) errFromJava.Exception.InnerException).Message);
+ }
+ }
+
+ /// <summary>
+ /// Tests the <see cref="QueryEntity"/> validation.
+ /// </summary>
+ [Test]
+ public void TestQueryEntityValidation()
+ {
+ var cacheCfg = new CacheConfiguration("cache1", new QueryEntity(typeof(uint), typeof(ulong))
+ {
+ Fields = new[]
+ {
+ new QueryField("myField", typeof(ushort))
+ }
+ });
+
+ var cfg = new IgniteConfiguration(GetConfigWithLogger())
+ {
+ CacheConfiguration = new[]
+ {
+ cacheCfg
+ }
+ };
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ // Check static and dynamic cache start
+ cacheCfg.Name = "cache2";
+ ignite.CreateCache<int, string>(cacheCfg);
+
+ var warns = TestLogger.Entries.Where(x => x.Level == LogLevel.Warn && x.Args != null)
+ .Select(x => string.Format(x.Message, x.Args)).ToList();
+
+ Assert.AreEqual(6, warns.Count);
+
+ Assert.AreEqual("Validating cache configuration 'cache1', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long': Type 'System.UInt32' maps to Java type 'java.lang.Integer' using unchecked " +
+ "conversion. This may cause issues in SQL queries. You can use 'System.Int32' " +
+ "instead to achieve direct mapping.", warns[0]);
+
+ Assert.AreEqual("Validating cache configuration 'cache1', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long': Type 'System.UInt64' maps to Java type 'java.lang.Long' using unchecked " +
+ "conversion. This may cause issues in SQL queries. You can use 'System.Int64' " +
+ "instead to achieve direct mapping.", warns[1]);
+
+ Assert.AreEqual("Validating cache configuration 'cache1', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long', QueryField 'myField': Type 'System.UInt16' maps to Java type 'java.lang." +
+ "Short' using unchecked conversion. This may cause issues in SQL queries. You " +
+ "can use 'System.Int16' instead to achieve direct mapping.", warns[2]);
+
+ Assert.AreEqual("Validating cache configuration 'cache2', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long': Type 'System.UInt32' maps to Java type 'java.lang.Integer' using unchecked " +
+ "conversion. This may cause issues in SQL queries. You can use 'System.Int32' " +
+ "instead to achieve direct mapping.", warns[3]);
+
+ Assert.AreEqual("Validating cache configuration 'cache2', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long': Type 'System.UInt64' maps to Java type 'java.lang.Long' using unchecked " +
+ "conversion. This may cause issues in SQL queries. You can use 'System.Int64' " +
+ "instead to achieve direct mapping.", warns[4]);
+
+ Assert.AreEqual("Validating cache configuration 'cache2', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long', QueryField 'myField': Type 'System.UInt16' maps to Java type 'java.lang." +
+ "Short' using unchecked conversion. This may cause issues in SQL queries. You " +
+ "can use 'System.Int16' instead to achieve direct mapping.", warns[5]);
+ }
+ }
+
+ /// <summary>
+ /// Tests the <see cref="LoggerExtensions"/> methods.
+ /// </summary>
+ [Test]
+ public void TestExtensions()
+ {
+ var log = new TestLogger(LogLevel.Trace);
+ var ex = new FieldAccessException("abc");
+
+ // Log
+ log.Log(LogLevel.Trace, "trace");
+ CheckLastMessage(LogLevel.Trace, "trace");
+
+ log.Log(LogLevel.Debug, "msg {0} {1}", 1, "2");
+ CheckLastMessage(LogLevel.Debug, "msg {0} {1}", new object[] { 1, "2" }, CultureInfo.InvariantCulture);
+
+ log.Log(LogLevel.Info, ex, "msg");
+ CheckLastMessage(LogLevel.Info, "msg", e: ex);
+
+ log.Log(LogLevel.Warn, ex, "msg {0}", 1);
+ CheckLastMessage(LogLevel.Warn, "msg {0}", new object[] {1}, CultureInfo.InvariantCulture, e: ex);
+
+ // Trace
+ log.Trace("trace");
+ CheckLastMessage(LogLevel.Trace, "trace");
+
+ log.Trace("msg {0} {1}", 1, "2");
+ CheckLastMessage(LogLevel.Trace, "msg {0} {1}", new object[] { 1, "2" }, CultureInfo.InvariantCulture);
+
+ log.Trace(ex, "msg");
+ CheckLastMessage(LogLevel.Trace, "msg", e: ex);
+
+ log.Trace(ex, "msg {0}", 1);
+ CheckLastMessage(LogLevel.Trace, "msg {0}", new object[] { 1 }, CultureInfo.InvariantCulture, e: ex);
+
+ // Debug
+ log.Debug("test");
+ CheckLastMessage(LogLevel.Debug, "test");
+
+ log.Debug("msg {0} {1}", 1, "2");
+ CheckLastMessage(LogLevel.Debug, "msg {0} {1}", new object[] { 1, "2" }, CultureInfo.InvariantCulture);
+
+ log.Debug(ex, "msg");
+ CheckLastMessage(LogLevel.Debug, "msg", e: ex);
+
+ log.Debug(ex, "msg {0}", 1);
+ CheckLastMessage(LogLevel.Debug, "msg {0}", new object[] { 1 }, CultureInfo.InvariantCulture, e: ex);
+
+ // Info
+ log.Info("test");
+ CheckLastMessage(LogLevel.Info, "test");
+
+ log.Info("msg {0} {1}", 1, "2");
+ CheckLastMessage(LogLevel.Info, "msg {0} {1}", new object[] { 1, "2" }, CultureInfo.InvariantCulture);
+
+ log.Info(ex, "msg");
+ CheckLastMessage(LogLevel.Info, "msg", e: ex);
+
+ log.Info(ex, "msg {0}", 1);
+ CheckLastMessage(LogLevel.Info, "msg {0}", new object[] { 1 }, CultureInfo.InvariantCulture, e: ex);
+
+ // Warn
+ log.Warn("test");
+ CheckLastMessage(LogLevel.Warn, "test");
+
+ log.Warn("msg {0} {1}", 1, "2");
+ CheckLastMessage(LogLevel.Warn, "msg {0} {1}", new object[] { 1, "2" }, CultureInfo.InvariantCulture);
+
+ log.Warn(ex, "msg");
+ CheckLastMessage(LogLevel.Warn, "msg", e: ex);
+
+ log.Warn(ex, "msg {0}", 1);
+ CheckLastMessage(LogLevel.Warn, "msg {0}", new object[] { 1 }, CultureInfo.InvariantCulture, e: ex);
+
+ // Error
+ log.Error("test");
+ CheckLastMessage(LogLevel.Error, "test");
+
+ log.Error("msg {0} {1}", 1, "2");
+ CheckLastMessage(LogLevel.Error, "msg {0} {1}", new object[] { 1, "2" }, CultureInfo.InvariantCulture);
+
+ log.Error(ex, "msg");
+ CheckLastMessage(LogLevel.Error, "msg", e: ex);
+
+ log.Error(ex, "msg {0}", 1);
+ CheckLastMessage(LogLevel.Error, "msg {0}", new object[] { 1 }, CultureInfo.InvariantCulture, e: ex);
+
+ // GetLogger
+ var catLog = log.GetLogger("myCategory");
+ catLog.Info("info");
+ CheckLastMessage(LogLevel.Info, "info", category: "myCategory");
+
+ catLog.Log(LogLevel.Info, "info", null, null, "explicitCat", null, null);
+ CheckLastMessage(LogLevel.Info, "info", category: "explicitCat");
+
+ catLog = catLog.GetLogger("newCat");
+ catLog.Info("info");
+ CheckLastMessage(LogLevel.Info, "info", category: "newCat");
+
+ catLog.Log(LogLevel.Info, "info", null, null, "explicitCat", null, null);
+ CheckLastMessage(LogLevel.Info, "info", category: "explicitCat");
+ }
+
+ /// <summary>
+ /// Checks the last message.
+ /// </summary>
+ private static void CheckLastMessage(LogLevel level, string message, object[] args = null,
+ IFormatProvider formatProvider = null, string category = null, string nativeErr = null, Exception e = null)
+ {
+ var msg = TestLogger.Entries.Last();
+
+ Assert.AreEqual(msg.Level, level);
+ Assert.AreEqual(msg.Message, message);
+ Assert.AreEqual(msg.Args, args);
+ Assert.AreEqual(msg.FormatProvider, formatProvider);
+ Assert.AreEqual(msg.Category, category);
+ Assert.AreEqual(msg.NativeErrorInfo, nativeErr);
+ Assert.AreEqual(msg.Exception, e);
+ }
+
+ /// <summary>
+ /// Gets the configuration with logger.
+ /// </summary>
+ private static IgniteConfiguration GetConfigWithLogger(bool verbose = false)
+ {
+ return new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ Logger = new TestLogger(verbose ? LogLevel.Trace : LogLevel.Info)
+ };
+ }
+
+ /// <summary>
+ /// Test log entry.
+ /// </summary>
+ private class LogEntry
+ {
+ public LogLevel Level;
+ public string Message;
+ public object[] Args;
+ public IFormatProvider FormatProvider;
+ public string Category;
+ public string NativeErrorInfo;
+ public Exception Exception;
+
+ public override string ToString()
+ {
+ return string.Format("Level: {0}, Message: {1}, Args: {2}, FormatProvider: {3}, Category: {4}, " +
+ "NativeErrorInfo: {5}, Exception: {6}", Level, Message, Args, FormatProvider,
+ Category, NativeErrorInfo, Exception);
+ }
+ }
+
+ /// <summary>
+ /// Test logger.
+ /// </summary>
+ private class TestLogger : ILogger
+ {
+ public static readonly List<LogEntry> Entries = new List<LogEntry>(5000);
+
+ private readonly LogLevel _minLevel;
+
+ public TestLogger(LogLevel minLevel)
+ {
+ _minLevel = minLevel;
+ }
+
+ public void Log(LogLevel level, string message, object[] args, IFormatProvider formatProvider,
+ string category, string nativeErrorInfo, Exception ex)
+ {
+ if (!IsEnabled(level))
+ return;
+
+ lock (Entries)
+ {
+ Entries.Add(new LogEntry
+ {
+ Level = level,
+ Message = message,
+ Args = args,
+ FormatProvider = formatProvider,
+ Category = category,
+ NativeErrorInfo = nativeErrorInfo,
+ Exception = ex
+ });
+ }
+ }
+
+ public bool IsEnabled(LogLevel level)
+ {
+ return level >= _minLevel;
+ }
+
+ [InstanceResource]
+ // ReSharper disable once UnusedAutoPropertyAccessor.Local
+ public IIgnite Ignite { get; set; }
+ }
+
+
+ /// <summary>
+ /// Failing lifecycle bean.
+ /// </summary>
+ private class FailBean : ILifecycleBean
+ {
+ public void OnLifecycleEvent(LifecycleEventType evt)
+ {
+ throw new ArithmeticException("Failure in bean");
+ }
+ }
+
+ /// <summary>
+ /// Failing computation.
+ /// </summary>
+ [Serializable]
+ private class FailFunc : IComputeFunc<string>
+ {
+ public string Invoke()
+ {
+ throw new ArithmeticException("Error in func.");
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/DefaultLoggerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/DefaultLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/DefaultLoggerTest.cs
new file mode 100644
index 0000000..6623416
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/DefaultLoggerTest.cs
@@ -0,0 +1,114 @@
+\ufeff/*
+ * 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.Log
+{
+ using System;
+ using System.IO;
+ using System.Linq;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Impl.Common;
+ using NUnit.Framework;
+ using LogLevel = Apache.Ignite.Core.Log.LogLevel;
+
+ /// <summary>
+ /// Tests the default logger.
+ /// </summary>
+ public class DefaultLoggerTest
+ {
+ /// <summary>
+ /// Tests that default Java mechanism is used when there is no custom logger.
+ /// </summary>
+ [Test]
+ public void TestJavaLogger()
+ {
+ // Run the test in a separate process because log4jlogger has some static state,
+ // and after Ignite has been started once, it is not possible to start a new node
+ // with a different logger config.
+ const string envVar = "DefaultLoggerTest.TestJavaLogger";
+
+ if (Environment.GetEnvironmentVariable(envVar) == "true")
+ {
+ // Delete all log files from the work dir
+ Func<string[]> getLogs = () =>
+ Directory.GetFiles(IgniteHome.Resolve(null), "dotnet-logger-test.log", SearchOption.AllDirectories);
+
+ getLogs().ToList().ForEach(File.Delete);
+
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(false))
+ {
+ SpringConfigUrl = @"config\log\custom-log.xml",
+ CacheConfiguration = new[]
+ {
+ new CacheConfiguration("cache1", new QueryEntity(typeof(uint), typeof(ulong)))
+ }
+ };
+
+ // Start Ignite and verify file log
+ using (var ignite = Ignition.Start(cfg))
+ {
+ // Log with all levels
+ var log = ignite.Logger;
+ var levels = new[] {LogLevel.Trace, LogLevel.Info, LogLevel.Debug, LogLevel.Warn, LogLevel.Error};
+
+ foreach (var level in levels)
+ {
+ var ex = new Exception("EXCEPTION_TEST_" + level);
+
+ log.Log(level, "DOTNET-" + level, null, null, "=DOTNET=", null, ex);
+ }
+ }
+
+ using (var fs = File.Open(getLogs().Single(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ {
+ var log = new StreamReader(fs).ReadToEnd();
+
+ // Check output from Java:
+ Assert.IsTrue(log.Contains(">>> Topology snapshot."));
+
+ // Check output from .NET:
+ Assert.IsTrue(log.Contains("Starting Ignite.NET " + typeof(Ignition).Assembly.GetName().Version));
+
+ Assert.IsTrue(log.Contains(
+ "Validating cache configuration 'cache1', QueryEntity 'java.lang.Integer:java.lang." +
+ "Long': Type 'System.UInt32' maps to Java type 'java.lang.Integer' using unchecked " +
+ "conversion. This may cause issues in SQL queries. You can use 'System.Int32' " +
+ "instead to achieve direct mapping."));
+
+
+ // Check custom log output (trace is disabled, errors are logged from Warn and up):
+ Assert.IsTrue(log.Contains("[INFO ][main][=DOTNET=] DOTNET-Info"));
+
+ Assert.IsTrue(log.Contains("[DEBUG][main][=DOTNET=] DOTNET-Debug"));
+
+ Assert.IsTrue(log.Contains("[WARN ][main][=DOTNET=] DOTNET-Warn"));
+ Assert.IsTrue(log.Contains("class org.apache.ignite.IgniteException: " +
+ "Platform error:System.Exception: EXCEPTION_TEST_Warn"));
+
+ Assert.IsTrue(log.Contains("[ERROR][main][=DOTNET=] DOTNET-Error"));
+ Assert.IsTrue(log.Contains("class org.apache.ignite.IgniteException: " +
+ "Platform error:System.Exception: EXCEPTION_TEST_Error"));
+ }
+ }
+ else
+ {
+ Environment.SetEnvironmentVariable(envVar, "true");
+ TestUtils.RunTestInNewProcess(GetType().FullName, "TestJavaLogger");
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 6ca2f9d..d3851db 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
+ using System.Diagnostics;
using System.Linq;
using System.Threading;
using Apache.Ignite.Core.Discovery.Tcp;
@@ -336,5 +337,30 @@ namespace Apache.Ignite.Core.Tests
JvmClasspath = CreateTestClasspath()
};
}
+
+ /// <summary>
+ /// Runs the test in new process.
+ /// </summary>
+ public static void RunTestInNewProcess(string fixtureName, string testName)
+ {
+ var procStart = new ProcessStartInfo
+ {
+ FileName = typeof(TestUtils).Assembly.Location,
+ Arguments = fixtureName + " " + testName,
+ CreateNoWindow = true,
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
+
+ var proc = System.Diagnostics.Process.Start(procStart);
+
+ Assert.IsNotNull(proc);
+
+ Console.WriteLine(proc.StandardOutput.ReadToEnd());
+ Console.WriteLine(proc.StandardError.ReadToEnd());
+ Assert.IsTrue(proc.WaitForExit(15000));
+ Assert.AreEqual(0, proc.ExitCode);
+ }
}
}
[29/30] ignite git commit: IGNITE-1629 .NET: Introduced native
logging facility - fix merge
Posted by pt...@apache.org.
IGNITE-1629 .NET: Introduced native logging facility - fix merge
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae4ae71f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae4ae71f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae4ae71f
Branch: refs/heads/master
Commit: ae4ae71f0481662a5fb13eb8ee63a17e6c4c3802
Parents: 3c9e254
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Oct 3 12:16:34 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Oct 3 12:16:34 2016 +0300
----------------------------------------------------------------------
modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae4ae71f/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 8e16fb5..7652092 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -24,6 +24,8 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
+ using System.Text;
+ using System.Xml;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
[09/30] ignite git commit: IGNITE-3993: Added failing client tests to
"ignored" test suite.
Posted by pt...@apache.org.
IGNITE-3993: Added failing client tests to "ignored" test suite.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d2563dac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d2563dac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d2563dac
Branch: refs/heads/master
Commit: d2563dacceea61b19bb6e083e29ebacc28fdd323
Parents: d595345
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 28 15:51:55 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 28 15:51:55 2016 +0300
----------------------------------------------------------------------
.../client/ClientReconnectionSelfTest.java | 4 +-
.../client/router/TcpSslRouterSelfTest.java | 7 +-
.../client/suite/IgniteClientTestSuite.java | 71 ++++++------
.../ignite/testframework/IgniteTestSuite.java | 116 ++++++++++++++++---
.../apache/ignite/testsuites/IgniteIgnore.java | 2 +-
modules/ignored-tests/pom.xml | 46 ++++++++
.../testsuites/IgniteIgnoredTestSuite.java | 5 +-
7 files changed, 192 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
index 92c8e76..f1085b3 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testsuites.IgniteIgnore;
/**
*
@@ -182,9 +183,8 @@ public class ClientReconnectionSelfTest extends GridCommonAbstractTest {
*
* @throws Exception If failed.
*/
+ @IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-590", forceFailure = true)
public void testIdleConnection() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-590");
-
int srvsCnt = 4; // TODO: IGNITE-590 it may be wrong value. Need to investigate after IGNITE-590 will be fixed.
for (int i = 0; i < srvsCnt; i++)
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
index 1e2a2bd..3b47ae5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
@@ -20,17 +20,14 @@ package org.apache.ignite.internal.client.router;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.client.ssl.GridSslContextFactory;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testsuites.IgniteIgnore;
/**
*
*/
+@IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-433", forceFailure = true)
public class TcpSslRouterSelfTest extends TcpRouterAbstractSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-433");
- }
-
- /** {@inheritDoc} */
@Override protected boolean useSsl() {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
index fdb5456..cc8f9fa 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.processors.rest.RestProcessorMultiStartSelfTes
import org.apache.ignite.internal.processors.rest.RestProcessorStartSelfTest;
import org.apache.ignite.internal.processors.rest.TaskCommandHandlerSelfTest;
import org.apache.ignite.internal.processors.rest.protocols.tcp.TcpRestParserSelfTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
/**
* Test suite includes all test that concern REST processors.
@@ -66,65 +67,65 @@ public class IgniteClientTestSuite extends TestSuite {
* @return Suite that contains all tests for REST.
*/
public static TestSuite suite() {
- TestSuite suite = new TestSuite("Ignite Clients Test Suite");
+ TestSuite suite = new IgniteTestSuite("Ignite Clients Test Suite");
- suite.addTest(new TestSuite(RouterFactorySelfTest.class));
+ suite.addTestSuite(RouterFactorySelfTest.class);
// Parser standalone test.
- suite.addTest(new TestSuite(TcpRestParserSelfTest.class));
+ suite.addTestSuite(TcpRestParserSelfTest.class);
// Test memcache protocol with custom test client.
- suite.addTest(new TestSuite(RestMemcacheProtocolSelfTest.class));
+ suite.addTestSuite(RestMemcacheProtocolSelfTest.class);
// Test custom binary protocol with test client.
- suite.addTest(new TestSuite(RestBinaryProtocolSelfTest.class));
+ suite.addTestSuite(RestBinaryProtocolSelfTest.class);
// Test jetty rest processor
- suite.addTest(new TestSuite(JettyRestProcessorSignedSelfTest.class));
- suite.addTest(new TestSuite(JettyRestProcessorUnsignedSelfTest.class));
+ suite.addTestSuite(JettyRestProcessorSignedSelfTest.class);
+ suite.addTestSuite(JettyRestProcessorUnsignedSelfTest.class);
// Test TCP rest processor with original memcache client.
- suite.addTest(new TestSuite(ClientMemcachedProtocolSelfTest.class));
+ suite.addTestSuite(ClientMemcachedProtocolSelfTest.class);
- suite.addTest(new TestSuite(RestProcessorStartSelfTest.class));
+ suite.addTestSuite(RestProcessorStartSelfTest.class);
// Test cache flag conversion.
- suite.addTest(new TestSuite(ClientCacheFlagsCodecTest.class));
+ suite.addTestSuite(ClientCacheFlagsCodecTest.class);
// Test multi-start.
- suite.addTest(new TestSuite(RestProcessorMultiStartSelfTest.class));
+ suite.addTestSuite(RestProcessorMultiStartSelfTest.class);
// Test clients.
- suite.addTest(new TestSuite(ClientDataImplSelfTest.class));
- suite.addTest(new TestSuite(ClientComputeImplSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpDirectSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpSslSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpSslDirectSelfTest.class));
+ suite.addTestSuite(ClientDataImplSelfTest.class);
+ suite.addTestSuite(ClientComputeImplSelfTest.class);
+ suite.addTestSuite(ClientTcpSelfTest.class);
+ suite.addTestSuite(ClientTcpDirectSelfTest.class);
+ suite.addTestSuite(ClientTcpSslSelfTest.class);
+ suite.addTestSuite(ClientTcpSslDirectSelfTest.class);
// Test client with many nodes.
- suite.addTest(new TestSuite(ClientTcpMultiNodeSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpDirectMultiNodeSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpSslMultiNodeSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpSslDirectMultiNodeSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpUnreachableMultiNodeSelfTest.class));
- suite.addTest(new TestSuite(ClientPreferDirectSelfTest.class));
+ suite.addTestSuite(ClientTcpMultiNodeSelfTest.class);
+ suite.addTestSuite(ClientTcpDirectMultiNodeSelfTest.class);
+ suite.addTestSuite(ClientTcpSslMultiNodeSelfTest.class);
+ suite.addTestSuite(ClientTcpSslDirectMultiNodeSelfTest.class);
+ suite.addTestSuite(ClientTcpUnreachableMultiNodeSelfTest.class);
+ suite.addTestSuite(ClientPreferDirectSelfTest.class);
// Test client with many nodes and in multithreaded scenarios
- suite.addTest(new TestSuite(ClientTcpMultiThreadedSelfTest.class));
- suite.addTest(new TestSuite(ClientTcpSslMultiThreadedSelfTest.class));
+ suite.addTestSuite(ClientTcpMultiThreadedSelfTest.class);
+ suite.addTestSuite(ClientTcpSslMultiThreadedSelfTest.class);
// Test client authentication.
- suite.addTest(new TestSuite(ClientTcpSslAuthenticationSelfTest.class));
+ suite.addTestSuite(ClientTcpSslAuthenticationSelfTest.class);
- suite.addTest(new TestSuite(ClientTcpConnectivitySelfTest.class));
- suite.addTest(new TestSuite(ClientReconnectionSelfTest.class));
+ suite.addTestSuite(ClientTcpConnectivitySelfTest.class);
+ suite.addTestSuite(ClientReconnectionSelfTest.class);
// Rest task command handler test.
- suite.addTest(new TestSuite(TaskCommandHandlerSelfTest.class));
+ suite.addTestSuite(TaskCommandHandlerSelfTest.class);
// Default cache only test.
- suite.addTest(new TestSuite(ClientDefaultCacheSelfTest.class));
+ suite.addTestSuite(ClientDefaultCacheSelfTest.class);
suite.addTestSuite(ClientFutureAdapterSelfTest.class);
suite.addTestSuite(ClientPropertiesConfigurationSelfTest.class);
@@ -134,13 +135,13 @@ public class IgniteClientTestSuite extends TestSuite {
suite.addTestSuite(ClientByteUtilsTest.class);
// Router tests.
- suite.addTest(new TestSuite(TcpRouterSelfTest.class));
- suite.addTest(new TestSuite(TcpSslRouterSelfTest.class));
- suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class));
+ suite.addTestSuite(TcpRouterSelfTest.class);
+ suite.addTestSuite(TcpSslRouterSelfTest.class);
+ suite.addTestSuite(TcpRouterMultiNodeSelfTest.class);
- suite.addTest(new TestSuite(ClientFailedInitSelfTest.class));
+ suite.addTestSuite(ClientFailedInitSelfTest.class);
- suite.addTest(new TestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class));
+ suite.addTestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class);
return suite;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
index 6dad032..7db9664 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
@@ -129,6 +129,8 @@ public class IgniteTestSuite extends TestSuite {
if(!Modifier.isPublic(theClass.getModifiers()))
addTest(warning("Class " + theClass.getName() + " is not public"));
else {
+ IgnoreDescriptor clsIgnore = IgnoreDescriptor.forClass(theClass);
+
Class superCls = theClass;
int testAdded = 0;
@@ -140,7 +142,7 @@ public class IgniteTestSuite extends TestSuite {
Method[] methods = MethodSorter.getDeclaredMethods(superCls);
for (Method each : methods) {
- if (addTestMethod(each, names, theClass))
+ if (addTestMethod(each, names, theClass, clsIgnore))
testAdded++;
else
testIgnored++;
@@ -158,9 +160,11 @@ public class IgniteTestSuite extends TestSuite {
* @param m Test method.
* @param names Test name list.
* @param theClass Test class.
+ * @param clsIgnore Class ignore descriptor (if any).
* @return Whether test method was added.
*/
- private boolean addTestMethod(Method m, List<String> names, Class<?> theClass) {
+ private boolean addTestMethod(Method m, List<String> names, Class<?> theClass,
+ @Nullable IgnoreDescriptor clsIgnore) {
String name = m.getName();
if (names.contains(name))
@@ -175,25 +179,20 @@ public class IgniteTestSuite extends TestSuite {
names.add(name);
- boolean hasIgnore = m.isAnnotationPresent(IgniteIgnore.class);
-
- if (ignoredOnly) {
- if (hasIgnore) {
- IgniteIgnore ignore = m.getAnnotation(IgniteIgnore.class);
+ IgnoreDescriptor ignore = IgnoreDescriptor.forMethod(theClass, m);
- String reason = ignore.value();
-
- if (F.isEmpty(reason))
- throw new IllegalArgumentException("Reason is not set for ignored test [class=" +
- theClass.getName() + ", method=" + name + ']');
+ if (ignore == null)
+ ignore = clsIgnore;
+ if (ignoredOnly) {
+ if (ignore != null) {
Test test = createTest(theClass, name);
if (ignore.forceFailure()) {
if (test instanceof GridAbstractTest)
- ((GridAbstractTest)test).forceFailure(ignore.value());
+ ((GridAbstractTest)test).forceFailure(ignore.reason());
else
- test = new ForcedFailure(name, ignore.value());
+ test = new ForcedFailure(name, ignore.reason());
}
addTest(test);
@@ -202,7 +201,7 @@ public class IgniteTestSuite extends TestSuite {
}
}
else {
- if (!hasIgnore) {
+ if (ignore == null) {
addTest(createTest(theClass, name));
return true;
@@ -251,6 +250,93 @@ public class IgniteTestSuite extends TestSuite {
}
/**
+ * Ignore descriptor.
+ */
+ private static class IgnoreDescriptor {
+ /** Reason. */
+ private final String reason;
+
+ /** Force failure. */
+ private final boolean forceFailure;
+
+ /**
+ * Get descriptor for class (if any).
+ *
+ * @param cls Class.
+ * @return Descriptor or {@code null}.
+ */
+ @Nullable public static IgnoreDescriptor forClass(Class cls) {
+ Class cls0 = cls;
+
+ while (Test.class.isAssignableFrom(cls0)) {
+ if (cls0.isAnnotationPresent(IgniteIgnore.class)) {
+ IgniteIgnore ignore = (IgniteIgnore)cls0.getAnnotation(IgniteIgnore.class);
+
+ String reason = ignore.value();
+
+ if (F.isEmpty(reason))
+ throw new IllegalArgumentException("Reason is not set for ignored test [class=" +
+ cls0.getName() + ']');
+
+ return new IgnoreDescriptor(reason, ignore.forceFailure());
+ }
+
+ cls0 = cls0.getSuperclass();
+ }
+
+ return null;
+ }
+
+ /**
+ * Get descriptor for method (if any).
+ *
+ * @param cls Class.
+ * @param mthd Method.
+ * @return Descriptor or {@code null}.
+ */
+ @Nullable public static IgnoreDescriptor forMethod(Class cls, Method mthd) {
+ if (mthd.isAnnotationPresent(IgniteIgnore.class)) {
+ IgniteIgnore ignore = mthd.getAnnotation(IgniteIgnore.class);
+
+ String reason = ignore.value();
+
+ if (F.isEmpty(reason))
+ throw new IllegalArgumentException("Reason is not set for ignored test [class=" +
+ cls.getName() + ", method=" + mthd.getName() + ']');
+
+ return new IgnoreDescriptor(reason, ignore.forceFailure());
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param reason Reason.
+ * @param forceFailure Force failure.
+ */
+ private IgnoreDescriptor(String reason, boolean forceFailure) {
+ this.reason = reason;
+ this.forceFailure = forceFailure;
+ }
+
+ /**
+ * @return Reason.
+ */
+ public String reason() {
+ return reason;
+ }
+
+ /**
+ * @return Force failure.
+ */
+ public boolean forceFailure() {
+ return forceFailure;
+ }
+ }
+
+ /**
* Test case simulating failure.
*/
private static class ForcedFailure extends TestCase {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
index dbb1d7a..05af2a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
* Annotation which indicates that the test is ignored.
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
+@Target({ElementType.METHOD, ElementType.TYPE})
public @interface IgniteIgnore {
/**
* Reason for ignore (usually link to JIRA ticket).
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/ignored-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/pom.xml b/modules/ignored-tests/pom.xml
index 336485c..142754e 100644
--- a/modules/ignored-tests/pom.xml
+++ b/modules/ignored-tests/pom.xml
@@ -52,6 +52,20 @@
<dependency>
<groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-clients</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
<artifactId>ignite-cloud</artifactId>
<version>${project.version}</version>
</dependency>
@@ -80,6 +94,12 @@
<dependency>
<groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-indexing</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
<artifactId>ignite-jta</artifactId>
<version>${project.version}</version>
</dependency>
@@ -100,6 +120,12 @@
<dependency>
<groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-rest-http</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${project.version}</version>
</dependency>
@@ -128,6 +154,26 @@
<!-- 3-rd party dependencies. -->
<dependency>
+ <groupId>com.google.code.simple-spring-memcached</groupId>
+ <artifactId>spymemcached</artifactId>
+ <version>2.7.3</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<version>1.5</version>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
index 2188cd6..fd92a35 100644
--- a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
+++ b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
@@ -37,13 +37,16 @@ public class IgniteIgnoredTestSuite extends TestSuite {
/* --- AWS --- */
suite.addTest(IgniteS3TestSuite.suite());
+ /* --- CLIENTS --- */
+ suite.addTest(org.apache.ignite.internal.client.suite.IgniteClientTestSuite.suite());
+
/* --- CLOUDS --- */
suite.addTest(IgniteCloudTestSuite.suite());
/* --- JTA --- */
suite.addTest(IgniteJtaTestSuite.suite());
- /* --- Spring --- */
+ /* --- SPRING --- */
suite.addTest(IgniteSpringTestSuite.suite());
/* --- WEB SESSIONS --- */
[23/30] ignite git commit: Revert "Fixed missing Apache header."
Posted by pt...@apache.org.
Revert "Fixed missing Apache header."
This reverts commit b280c3efa1eb84c6bc8abbe31ba669b0c24323d8.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f745371a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f745371a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f745371a
Branch: refs/heads/master
Commit: f745371af76baa676385c22257b4577d2e697d16
Parents: c32082f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 3 10:07:26 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 3 10:07:26 2016 +0300
----------------------------------------------------------------------
.../internal/binary/BinaryFieldOrderSelfTest.java | 17 -----------------
1 file changed, 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f745371a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
index e470948..6bb1e13 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldOrderSelfTest.java
@@ -1,20 +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.
- * 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.binary;
import org.apache.ignite.binary.BinaryObject;
[08/30] ignite git commit: ignite-3621 Fixed 'testEvictExpired'.
Posted by pt...@apache.org.
ignite-3621 Fixed 'testEvictExpired'.
(cherry picked from commit bfe4458)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/74d2fc24
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/74d2fc24
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/74d2fc24
Branch: refs/heads/master
Commit: 74d2fc2416b8e6bc0598152552021f984a013061
Parents: b2faa33
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 14:31:24 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 15:43:42 2016 +0300
----------------------------------------------------------------------
...heAtomicClientOnlyMultiNodeFullApiSelfTest.java | 17 +++++++++++++++--
...acheAtomicNearOnlyMultiNodeFullApiSelfTest.java | 17 +++++++++++++++--
2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/74d2fc24/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
index 927ee62..65f780b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
@@ -45,6 +46,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNSWAPPED;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
*
@@ -193,7 +195,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
@Override public void testEvictExpired() throws Exception {
IgniteCache<String, Integer> cache = jcache();
- String key = primaryKeysForCache(cache, 1).get(0);
+ final String key = primaryKeysForCache(cache, 1).get(0);
cache.put(key, 1);
@@ -204,7 +206,18 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
grid(0).cache(null).
withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
- Thread.sleep(ttl + 100);
+ boolean wait = waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
+ }
+ }, ttl + 1000);
+
+ assertTrue("Failed to wait for entry expiration.", wait);
// Expired entry should not be swapped.
cache.localEvict(Collections.singleton(key));
http://git-wip-us.apache.org/repos/asf/ignite/blob/74d2fc24/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index 3ce38f3..6542e76 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -29,9 +29,11 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
* Tests NEAR_ONLY cache.
@@ -124,7 +126,7 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
IgniteCache<String, Integer> cache = jcache();
- String key = primaryKeysForCache(cache, 1).get(0);
+ final String key = primaryKeysForCache(cache, 1).get(0);
cache.put(key, 1);
@@ -135,7 +137,18 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
grid(0).cache(null).
withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
- Thread.sleep(ttl + 100);
+ boolean wait = waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ for (int i = 0; i < gridCount(); i++) {
+ if (peek(jcache(i), key) != null)
+ return false;
+ }
+
+ return true;
+ }
+ }, ttl + 1000);
+
+ assertTrue("Failed to wait for entry expiration.", wait);
// Expired entry should not be swapped.
cache.localEvict(Collections.singleton(key));
[13/30] ignite git commit: IGNITE-3995 .NET: Introduced default
non-null ASP.NET Session-State Store Provider cache name. This closes #1128.
Posted by pt...@apache.org.
IGNITE-3995 .NET: Introduced default non-null ASP.NET Session-State Store Provider cache name. This closes #1128.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/53229e29
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/53229e29
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/53229e29
Branch: refs/heads/master
Commit: 53229e290f7d6aab9b504693bd2b93155ecd2bad
Parents: bfe4458
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Sep 28 17:07:47 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 28 17:07:47 2016 +0300
----------------------------------------------------------------------
.../IgniteSessionStateStoreProviderTest.cs | 13 +++++++++++++
.../Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs | 2 +-
.../IgniteSessionStateStoreProvider.cs | 8 +++++++-
.../dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs | 13 +++++++------
4 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
index fc239ad..2c73359 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
@@ -133,6 +133,19 @@ namespace Apache.Ignite.AspNet.Tests
stateProvider = GetProvider();
CheckProvider(stateProvider);
+
+ // Omitted cache name results in default cache name (not null).
+ stateProvider = new IgniteSessionStateStoreProvider();
+
+ stateProvider.Initialize("testName", new NameValueCollection
+ {
+ {GridNameAttr, GridName}
+ });
+
+ var cacheNames = Ignition.GetIgnite(GridName).GetCacheNames();
+
+ Assert.IsFalse(cacheNames.Contains(null));
+ Assert.IsTrue(cacheNames.Contains(IgniteSessionStateStoreProvider.DefaultCacheName));
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
index d232726..2790493 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
@@ -99,7 +99,7 @@ namespace Apache.Ignite.AspNet
{
base.Initialize(name, config);
- var cache = ConfigUtil.InitializeCache<string, object>(config, GetType());
+ var cache = ConfigUtil.InitializeCache<string, object>(config, GetType(), null);
_expiryCacheHolder = new ExpiryCacheHolder<string, object>(cache);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 1ee6d92..86035dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -47,6 +47,11 @@ namespace Apache.Ignite.AspNet
/// </summary>
public class IgniteSessionStateStoreProvider : SessionStateStoreProviderBase
{
+ /// <summary>
+ /// The default cache name to be used when <c>cacheName</c> attribute is not specified.
+ /// </summary>
+ public const string DefaultCacheName = "ASPNET_SESSION_STATE";
+
/** Extension id */
private const int ExtensionId = 0;
@@ -94,7 +99,8 @@ namespace Apache.Ignite.AspNet
{
base.Initialize(name, config);
- var cache = ConfigUtil.InitializeCache<string, IgniteSessionStateStoreData>(config, GetType());
+ var cache = ConfigUtil.InitializeCache<string, IgniteSessionStateStoreData>(config, GetType(),
+ DefaultCacheName);
_expiryCacheHolder = new ExpiryCacheHolder<string, IgniteSessionStateStoreData>(cache);
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
index 3eb3d90..a162d81 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.AspNet.Impl
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
+ using System.Linq;
using Apache.Ignite.Core;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
@@ -33,24 +34,25 @@ namespace Apache.Ignite.AspNet.Impl
internal static class ConfigUtil
{
/** */
- public const string GridName = "gridName";
+ private const string GridName = "gridName";
/** */
- public const string CacheName = "cacheName";
+ private const string CacheName = "cacheName";
/** */
- public const string IgniteConfigurationSectionName = "igniteConfigurationSectionName";
+ private const string IgniteConfigurationSectionName = "igniteConfigurationSectionName";
/// <summary>
/// Initializes the cache from configuration.
/// </summary>
- public static ICache<TK, TV> InitializeCache<TK, TV>(NameValueCollection config, Type callerType)
+ public static ICache<TK, TV> InitializeCache<TK, TV>(NameValueCollection config, Type callerType,
+ string defaultCacheName)
{
Debug.Assert(config != null);
Debug.Assert(callerType != null);
var gridName = config[GridName];
- var cacheName = config[CacheName];
+ var cacheName = config.AllKeys.Contains(CacheName) ? config[CacheName] : defaultCacheName;
var cfgSection = config[IgniteConfigurationSectionName];
try
@@ -66,7 +68,6 @@ namespace Apache.Ignite.AspNet.Impl
throw new IgniteException(string.Format(CultureInfo.InvariantCulture,
"Failed to initialize {0}: {1}", callerType, ex), ex);
}
-
}
/// <summary>
[27/30] ignite git commit: IGNITE-1629 .NET: Introduced native
logging facility
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 59bf090..db2a96b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -308,7 +308,6 @@
<Compile Include="Impl\Common\IgniteConfigurationXmlSerializer.cs" />
<Compile Include="Impl\Common\IgniteHome.cs" />
<Compile Include="Impl\Common\LoadedAssembliesResolver.cs" />
- <Compile Include="Impl\Common\Logger.cs" />
<Compile Include="Impl\Common\ResizeableArray.cs" />
<Compile Include="Impl\Common\TypeCaster.cs" />
<Compile Include="Impl\Common\TypeStringConverter.cs" />
@@ -343,6 +342,7 @@
<Compile Include="Impl\Ignite.cs" />
<Compile Include="Impl\IgniteManager.cs" />
<Compile Include="Impl\IgniteProxy.cs" />
+ <Compile Include="Impl\Log\JavaLogger.cs" />
<Compile Include="Impl\PlatformTarget.cs" />
<Compile Include="Impl\IgniteUtils.cs" />
<Compile Include="Impl\Handle\Handle.cs" />
@@ -435,6 +435,10 @@
<Compile Include="Interop\Package-Info.cs" />
<Compile Include="Lifecycle\ClientReconnectEventArgs.cs" />
<Compile Include="Lifecycle\Package-Info.cs" />
+ <Compile Include="Log\CategoryLogger.cs" />
+ <Compile Include="Log\ILogger.cs" />
+ <Compile Include="Log\LoggerExtensions.cs" />
+ <Compile Include="Log\LogLevel.cs" />
<Compile Include="Messaging\Package-Info.cs" />
<Compile Include="Package-Info.cs" />
<Compile Include="Lifecycle\ILifecycleBean.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index e5e79cd..cb15564 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using System;
using System.Collections.Generic;
using System.ComponentModel;
+ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Apache.Ignite.Core.Binary;
@@ -35,6 +36,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache.Affinity;
+ using Apache.Ignite.Core.Log;
/// <summary>
/// Defines grid cache configuration.
@@ -353,6 +355,21 @@ namespace Apache.Ignite.Core.Cache.Configuration
}
/// <summary>
+ /// Validates this instance and outputs information to the log, if necessary.
+ /// </summary>
+ internal void Validate(ILogger log)
+ {
+ Debug.Assert(log != null);
+
+ var entities = QueryEntities;
+ if (entities != null)
+ {
+ foreach (var entity in entities)
+ entity.Validate(log, string.Format("Validating cache configuration '{0}'", Name ?? ""));
+ }
+ }
+
+ /// <summary>
/// Gets or sets write synchronization mode. This mode controls whether the main
/// caller should wait for update on other nodes to complete or not.
/// </summary>
@@ -669,7 +686,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Gets or sets the affinity function to provide mapping from keys to nodes.
/// <para />
- /// Predefined implementations:
+ /// Predefined implementations:
/// <see cref="RendezvousAffinityFunction"/>, <see cref="FairAffinityFunction"/>.
/// </summary>
public IAffinityFunction AffinityFunction { get; set; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
index e6eceb8..adfe9e1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using System.Reflection;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Log;
/// <summary>
/// Query entity is a description of cache entry (composed of key and value)
@@ -104,7 +105,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
KeyTypeName = value == null
? null
- : (JavaTypes.GetJavaTypeNameAndLogWarning(value) ?? BinaryUtils.GetTypeName(value));
+ : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetTypeName(value));
_keyType = value;
}
@@ -140,7 +141,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
ValueTypeName = value == null
? null
- : (JavaTypes.GetJavaTypeNameAndLogWarning(value) ?? BinaryUtils.GetTypeName(value));
+ : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetTypeName(value));
_valueType = value;
}
@@ -239,6 +240,26 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteInt(0);
}
+ /// <summary>
+ /// Validates this instance and outputs information to the log, if necessary.
+ /// </summary>
+ internal void Validate(ILogger log, string logInfo)
+ {
+ Debug.Assert(log != null);
+ Debug.Assert(logInfo != null);
+
+ logInfo += string.Format(", QueryEntity '{0}:{1}'", _keyTypeName ?? "", _valueTypeName ?? "");
+
+ JavaTypes.LogIndirectMappingWarning(_keyType, log, logInfo);
+ JavaTypes.LogIndirectMappingWarning(_valueType, log, logInfo);
+
+ var fields = Fields;
+ if (fields != null)
+ {
+ foreach (var field in fields)
+ field.Validate(log, logInfo);
+ }
+ }
/// <summary>
/// Rescans the attributes in <see cref="KeyType"/> and <see cref="ValueType"/>.
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
index b11e53d..12028e2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
@@ -20,8 +20,10 @@
namespace Apache.Ignite.Core.Cache.Configuration
{
using System;
+ using System.Diagnostics;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Common;
+ using Apache.Ignite.Core.Log;
/// <summary>
/// Represents a queryable field.
@@ -71,7 +73,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
}
/// <summary>
- /// Gets the field name.
+ /// Gets or sets the field name.
/// </summary>
public string Name { get; set; }
@@ -87,7 +89,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
{
FieldTypeName = value == null
? null
- : (JavaTypes.GetJavaTypeNameAndLogWarning(value) ?? BinaryUtils.GetTypeName(value));
+ : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetTypeName(value));
_type = value;
}
@@ -105,5 +107,18 @@ namespace Apache.Ignite.Core.Cache.Configuration
_type = null;
}
}
+
+ /// <summary>
+ /// Validates this instance and outputs information to the log, if necessary.
+ /// </summary>
+ internal void Validate(ILogger log, string logInfo)
+ {
+ Debug.Assert(log != null);
+ Debug.Assert(logInfo != null);
+
+ logInfo += string.Format(", QueryField '{0}'", Name);
+
+ JavaTypes.LogIndirectMappingWarning(_type, log, logInfo);
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index a16ae3a..91aa1dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -29,6 +29,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Datastream;
using Apache.Ignite.Core.DataStructures;
using Apache.Ignite.Core.Events;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Lifecycle;
using Apache.Ignite.Core.Messaging;
using Apache.Ignite.Core.Services;
@@ -277,6 +278,13 @@ namespace Apache.Ignite.Core
ICollection<string> GetCacheNames();
/// <summary>
+ /// Gets the logger.
+ /// <para />
+ /// See <see cref="IgniteConfiguration.Logger"/> for customization.
+ /// </summary>
+ ILogger Logger { get; }
+
+ /// <summary>
/// Occurs when node begins to stop. Node is fully functional at this point.
/// See also: <see cref="LifecycleEventType.BeforeNodeStop"/>.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 6bdf1ab..8e16fb5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -38,6 +38,7 @@
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Lifecycle;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Transactions;
using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader;
using BinaryWriter = Apache.Ignite.Core.Impl.Binary.BinaryWriter;
@@ -292,6 +293,21 @@
}
/// <summary>
+ /// Validates this instance and outputs information to the log, if necessary.
+ /// </summary>
+ internal void Validate(ILogger log)
+ {
+ Debug.Assert(log != null);
+
+ var ccfg = CacheConfiguration;
+ if (ccfg != null)
+ {
+ foreach (var cfg in ccfg)
+ cfg.Validate(log);
+ }
+ }
+
+ /// <summary>
/// Reads data from specified reader into current instance.
/// </summary>
/// <param name="r">The binary reader.</param>
@@ -398,6 +414,7 @@
Assemblies = cfg.Assemblies;
SuppressWarnings = cfg.SuppressWarnings;
LifecycleBeans = cfg.LifecycleBeans;
+ Logger = cfg.Logger;
JvmInitialMemoryMb = cfg.JvmInitialMemoryMb;
JvmMaxMemoryMb = cfg.JvmMaxMemoryMb;
}
@@ -678,5 +695,76 @@
get { return _isLateAffinityAssignment ?? DefaultIsLateAffinityAssignment; }
set { _isLateAffinityAssignment = value; }
}
+
+ /// <summary>
+ /// Serializes this instance to the specified XML writer.
+ /// </summary>
+ /// <param name="writer">The writer.</param>
+ /// <param name="rootElementName">Name of the root element.</param>
+ public void ToXml(XmlWriter writer, string rootElementName)
+ {
+ IgniteArgumentCheck.NotNull(writer, "writer");
+ IgniteArgumentCheck.NotNullOrEmpty(rootElementName, "rootElementName");
+
+ IgniteConfigurationXmlSerializer.Serialize(this, writer, rootElementName);
+ }
+
+ /// <summary>
+ /// Serializes this instance to an XML string.
+ /// </summary>
+ public string ToXml()
+ {
+ var sb = new StringBuilder();
+
+ var settings = new XmlWriterSettings
+ {
+ Indent = true
+ };
+
+ using (var xmlWriter = XmlWriter.Create(sb, settings))
+ {
+ ToXml(xmlWriter, "igniteConfiguration");
+ }
+
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// Deserializes IgniteConfiguration from the XML reader.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ /// <returns>Deserialized instance.</returns>
+ public static IgniteConfiguration FromXml(XmlReader reader)
+ {
+ IgniteArgumentCheck.NotNull(reader, "reader");
+
+ return IgniteConfigurationXmlSerializer.Deserialize(reader);
+ }
+
+ /// <summary>
+ /// Deserializes IgniteConfiguration from the XML string.
+ /// </summary>
+ /// <param name="xml">Xml string.</param>
+ /// <returns>Deserialized instance.</returns>
+ public static IgniteConfiguration FromXml(string xml)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(xml, "xml");
+
+ using (var xmlReader = XmlReader.Create(new StringReader(xml)))
+ {
+ // Skip XML header.
+ xmlReader.MoveToContent();
+
+ return FromXml(xmlReader);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the logger.
+ /// <para />
+ /// If no logger is set, logging is delegated to Java, which uses the logger defined in Spring XML (if present)
+ /// or logs to console otherwise.
+ /// </summary>
+ public ILogger Logger { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 24eaa30..916fd20 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -357,6 +357,18 @@
<xs:attribute name="pessimisticTransactionLogLinger" type="xs:string" />
</xs:complexType>
</xs:element>
+ <xs:element name="logger" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>The logger. If no logger is set, logging is delegated to Java, which uses the logger defined in Spring XML (if present) or logs to console otherwise.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>Assembly-qualified type name.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
</xs:all>
<xs:attribute name="gridName" type="xs:string" />
<xs:attribute name="jvmDllPath" type="xs:string" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
index 552a7f2..7b023f3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -35,9 +35,11 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Impl.Cache.Affinity;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Handle;
+ using Apache.Ignite.Core.Impl.Log;
using Apache.Ignite.Core.Impl.Memory;
using Apache.Ignite.Core.Impl.Unmanaged;
using Apache.Ignite.Core.Lifecycle;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Resource;
using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader;
using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
@@ -201,15 +203,21 @@ namespace Apache.Ignite.Core
lock (SyncRoot)
{
+ // 0. Init logger
+ var log = cfg.Logger ?? new JavaLogger();
+
+ log.Debug("Starting Ignite.NET " + Assembly.GetExecutingAssembly().GetName().Version);
+
// 1. Check GC settings.
- CheckServerGc(cfg);
+ CheckServerGc(cfg, log);
// 2. Create context.
- IgniteUtils.LoadDlls(cfg.JvmDllPath);
+ IgniteUtils.LoadDlls(cfg.JvmDllPath, log);
- var cbs = new UnmanagedCallbacks();
+ var cbs = new UnmanagedCallbacks(log);
- IgniteManager.CreateJvmContext(cfg, cbs);
+ IgniteManager.CreateJvmContext(cfg, cbs, log);
+ log.Debug("JVM started.");
var gridName = cfg.GridName;
@@ -221,12 +229,17 @@ namespace Apache.Ignite.Core
try
{
// 4. Initiate Ignite start.
- UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl, gridName, ClientMode);
+ UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl, gridName, ClientMode, cfg.Logger != null);
+
// 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
var node = _startup.Ignite;
interopProc = node.InteropProcessor;
+ var javaLogger = log as JavaLogger;
+ if (javaLogger != null)
+ javaLogger.SetProcessor(interopProc);
+
// 6. On-start callback (notify lifecycle components).
node.OnStart();
@@ -271,10 +284,11 @@ namespace Apache.Ignite.Core
/// Check whether GC is set to server mode.
/// </summary>
/// <param name="cfg">Configuration.</param>
- private static void CheckServerGc(IgniteConfiguration cfg)
+ /// <param name="log">Log.</param>
+ private static void CheckServerGc(IgniteConfiguration cfg, ILogger log)
{
if (!cfg.SuppressWarnings && !GCSettings.IsServerGC && Interlocked.CompareExchange(ref _gcWarn, 1, 0) == 0)
- Logger.LogWarning("GC server mode is not enabled, this could lead to less " +
+ log.Warn("GC server mode is not enabled, this could lead to less " +
"than optimal performance on multi-core machines (to enable see " +
"http://msdn.microsoft.com/en-us/library/ms229357(v=vs.110).aspx).");
}
@@ -285,14 +299,15 @@ namespace Apache.Ignite.Core
/// <param name="inStream">Input stream with data.</param>
/// <param name="outStream">Output stream.</param>
/// <param name="handleRegistry">Handle registry.</param>
- internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream,
- HandleRegistry handleRegistry)
+ /// <param name="log">Log.</param>
+ internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream,
+ HandleRegistry handleRegistry, ILogger log)
{
try
{
BinaryReader reader = BinaryUtils.Marshaller.StartUnmarshal(inStream);
- PrepareConfiguration(reader, outStream);
+ PrepareConfiguration(reader, outStream, log);
PrepareLifecycleBeans(reader, outStream, handleRegistry);
@@ -313,7 +328,8 @@ namespace Apache.Ignite.Core
/// </summary>
/// <param name="reader">Reader.</param>
/// <param name="outStream">Response stream.</param>
- private static void PrepareConfiguration(BinaryReader reader, PlatformMemoryStream outStream)
+ /// <param name="log">Log.</param>
+ private static void PrepareConfiguration(BinaryReader reader, PlatformMemoryStream outStream, ILogger log)
{
// 1. Load assemblies.
IgniteConfiguration cfg = _startup.Configuration;
@@ -334,6 +350,7 @@ namespace Apache.Ignite.Core
_startup.Marshaller = new Marshaller(cfg.BinaryConfiguration);
// 3. Send configuration details to Java
+ cfg.Validate(log);
cfg.Write(_startup.Marshaller.StartMarshal(outStream));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
index f30264d..a8d94f2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Core.Impl.Binary
using System;
using System.Collections.Generic;
using System.Linq;
- using Apache.Ignite.Core.Impl.Common;
+ using Apache.Ignite.Core.Log;
/// <summary>
/// Provides mapping between Java and .NET basic types.
@@ -67,26 +67,33 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Gets the corresponding Java type name.
- /// Logs a warning for indirectly mapped types.
/// </summary>
- public static string GetJavaTypeNameAndLogWarning(Type type)
+ public static string GetJavaTypeName(Type type)
{
if (type == null)
return null;
string res;
- if (!NetToJava.TryGetValue(type, out res))
- return null;
+ return NetToJava.TryGetValue(type, out res) ? res : null;
+ }
- Type directType;
+ /// <summary>
+ /// Logs a warning for indirectly mapped types.
+ /// </summary>
+ public static void LogIndirectMappingWarning(Type type, ILogger log, string logInfo)
+ {
+ if (type == null)
+ return;
- if (IndirectMappingTypes.TryGetValue(type, out directType))
- Logger.LogWarning("Type '{0}' maps to Java type '{1}' using unchecked conversion. " +
- "This may cause issues in SQL queries. " +
- "You can use '{2}' instead to achieve direct mapping.", type, res, directType);
+ Type directType;
+ if (!IndirectMappingTypes.TryGetValue(type, out directType))
+ return;
- return res;
+ log.Warn("{0}: Type '{1}' maps to Java type '{2}' using unchecked conversion. " +
+ "This may cause issues in SQL queries. " +
+ "You can use '{3}' instead to achieve direct mapping.",
+ logInfo, type, NetToJava[type], directType);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Logger.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Logger.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Logger.cs
deleted file mode 100644
index cab5afc..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Logger.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-\ufeff/*
-* 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.Impl.Common
-{
- using System;
-
- /// <summary>
- /// Console logger.
- /// </summary>
- internal static class Logger
- {
- /// <summary>
- /// Logs the warning.
- /// </summary>
- /// <param name="warning">The warning.</param>
- /// <param name="args">The arguments.</param>
- public static void LogWarning(string warning, params object[] args)
- {
- Console.WriteLine("WARNING: " + string.Format(warning, args));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index 0fac417..2a3a014 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -43,6 +43,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Impl.Transactions;
using Apache.Ignite.Core.Impl.Unmanaged;
using Apache.Ignite.Core.Lifecycle;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Messaging;
using Apache.Ignite.Core.Services;
using Apache.Ignite.Core.Transactions;
@@ -407,6 +408,7 @@ namespace Apache.Ignite.Core.Impl
NearCacheConfiguration nearConfiguration)
{
IgniteArgumentCheck.NotNull(configuration, "configuration");
+ configuration.Validate(Logger);
using (var stream = IgniteManager.Memory.Allocate().GetStream())
{
@@ -445,6 +447,7 @@ namespace Apache.Ignite.Core.Impl
NearCacheConfiguration nearConfiguration)
{
IgniteArgumentCheck.NotNull(configuration, "configuration");
+ configuration.Validate(Logger);
using (var stream = IgniteManager.Memory.Allocate().GetStream())
{
@@ -674,6 +677,12 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
+ public ILogger Logger
+ {
+ get { return _cbs.Log; }
+ }
+
+ /** <inheritdoc /> */
public event EventHandler Stopping;
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
index 05bc786..ee54218 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Memory;
using Apache.Ignite.Core.Impl.Unmanaged;
+ using Apache.Ignite.Core.Log;
using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
/// <summary>
@@ -57,8 +58,9 @@ namespace Apache.Ignite.Core.Impl
/// </summary>
/// <param name="cfg">Configuration.</param>
/// <param name="cbs">Callbacks.</param>
+ /// <param name="log"></param>
/// <returns>Context.</returns>
- internal static void CreateJvmContext(IgniteConfiguration cfg, UnmanagedCallbacks cbs)
+ internal static void CreateJvmContext(IgniteConfiguration cfg, UnmanagedCallbacks cbs, ILogger log)
{
lock (SyncRoot)
{
@@ -69,7 +71,7 @@ namespace Apache.Ignite.Core.Impl
{
if (!_jvmCfg.Equals(jvmCfg))
{
- Logger.LogWarning("Attempting to start Ignite node with different Java " +
+ log.Warn("Attempting to start Ignite node with different Java " +
"configuration; current Java configuration will be ignored (consider " +
"starting node in separate process) [oldConfig=" + _jvmCfg +
", newConfig=" + jvmCfg + ']');
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
index 12de847..914a87d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
@@ -31,6 +31,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cluster;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Lifecycle;
using Apache.Ignite.Core.Messaging;
using Apache.Ignite.Core.Services;
@@ -392,6 +393,12 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
+ public ILogger Logger
+ {
+ get { return _ignite.Logger; }
+ }
+
+ /** <inheritdoc /> */
public event EventHandler Stopping
{
add { _ignite.Stopping += value; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
index 048c8ac..70d483d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
@@ -35,6 +35,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Impl.Cluster;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Unmanaged;
+ using Apache.Ignite.Core.Log;
using Microsoft.Win32;
using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader;
@@ -124,12 +125,17 @@ namespace Apache.Ignite.Core.Impl
/// Load JVM DLL if needed.
/// </summary>
/// <param name="configJvmDllPath">JVM DLL path from config.</param>
- public static void LoadDlls(string configJvmDllPath)
+ /// <param name="log">Log.</param>
+ public static void LoadDlls(string configJvmDllPath, ILogger log)
{
- if (_loaded) return;
+ if (_loaded)
+ {
+ log.Debug("JNI dll is already loaded.");
+ return;
+ }
// 1. Load JNI dll.
- LoadJvmDll(configJvmDllPath);
+ LoadJvmDll(configJvmDllPath, log);
// 2. Load GG JNI dll.
UnmanagedUtils.Initialize();
@@ -190,17 +196,25 @@ namespace Apache.Ignite.Core.Impl
/// <summary>
/// Loads the JVM DLL.
/// </summary>
- private static void LoadJvmDll(string configJvmDllPath)
+ private static void LoadJvmDll(string configJvmDllPath, ILogger log)
{
var messages = new List<string>();
foreach (var dllPath in GetJvmDllPaths(configJvmDllPath))
{
+ log.Debug("Trying to load JVM dll from [option={0}, path={1}]...", dllPath.Key, dllPath.Value);
+
var errCode = LoadDll(dllPath.Value, FileJvmDll);
if (errCode == 0)
+ {
+ log.Debug("jvm.dll successfully loaded from [option={0}, path={1}]", dllPath.Key, dllPath.Value);
return;
+ }
+
+ var message = string.Format(CultureInfo.InvariantCulture, "[option={0}, path={1}, error={2}]",
+ dllPath.Key, dllPath.Value, FormatWin32Error(errCode));
+ messages.Add(message);
- messages.Add(string.Format(CultureInfo.InvariantCulture, "[option={0}, path={1}, error={2}]",
- dllPath.Key, dllPath.Value, FormatWin32Error(errCode)));
+ log.Debug("Failed to load jvm.dll: " + message);
if (dllPath.Value == configJvmDllPath)
break; // if configJvmDllPath is specified and is invalid - do not try other options
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
new file mode 100644
index 0000000..23e7a37
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
@@ -0,0 +1,110 @@
+\ufeff/*
+ * 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.Impl.Log
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Linq;
+ using Apache.Ignite.Core.Impl.Unmanaged;
+ using Apache.Ignite.Core.Log;
+
+ /// <summary>
+ /// Logger that delegates to Java.
+ /// </summary>
+ internal class JavaLogger : ILogger
+ {
+ /** */
+ private IUnmanagedTarget _proc;
+
+ /** */
+ private readonly List<LogLevel> _enabledLevels = new List<LogLevel>(5);
+
+ /** */
+ private readonly List<Tuple<LogLevel, string, string, string>> _pendingLogs
+ = new List<Tuple<LogLevel, string, string, string>>();
+
+ /** */
+ private readonly object _syncRoot = new object();
+
+ /// <summary>
+ /// Sets the processor.
+ /// </summary>
+ /// <param name="proc">The proc.</param>
+ public void SetProcessor(IUnmanagedTarget proc)
+ {
+ Debug.Assert(proc != null);
+
+ lock (_syncRoot)
+ {
+ _proc = proc;
+
+ // Preload enabled levels.
+ _enabledLevels.AddRange(
+ new[] { LogLevel.Trace, LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error }
+ .Where(x => UnmanagedUtils.ProcessorLoggerIsLevelEnabled(proc, (int)x)));
+
+ foreach (var log in _pendingLogs)
+ {
+ Log(log.Item1, log.Item2, log.Item3, log.Item4);
+ }
+ }
+ }
+
+ /** <inheritdoc /> */
+ public void Log(LogLevel level, string message, object[] args, IFormatProvider formatProvider, string category,
+ string nativeErrorInfo, Exception ex)
+ {
+ // Java error info should not go back to Java.
+ // Either we log in .NET, and Java sends us logs, or we log in Java, and .NET sends logs, not both.
+ Debug.Assert(nativeErrorInfo == null);
+
+ lock (_syncRoot)
+ {
+ if (!IsEnabled(level))
+ return;
+
+ var msg = args == null ? message : string.Format(formatProvider, message, args);
+ var err = ex != null ? ex.ToString() : null;
+
+ if (_proc != null)
+ Log(level, msg, category, err);
+ else
+ _pendingLogs.Add(Tuple.Create(level, msg, category, err));
+ }
+ }
+
+ /** <inheritdoc /> */
+ public bool IsEnabled(LogLevel level)
+ {
+ lock (_syncRoot)
+ {
+ return _proc == null || _enabledLevels.Contains(level);
+ }
+ }
+
+ /// <summary>
+ /// Logs the message.
+ /// </summary>
+ private void Log(LogLevel level, string msg, string category, string err)
+ {
+ if (IsEnabled(level))
+ UnmanagedUtils.ProcessorLoggerLog(_proc, (int)level, msg, category, err);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
index 2da4192..8756dec 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
@@ -113,6 +113,13 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetCacheNames")]
public static extern void ProcessorGetCacheNames(void* ctx, void* obj, long memPtr);
+ [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorLoggerIsLevelEnabled")]
+ [return: MarshalAs(UnmanagedType.U1)]
+ public static extern bool ProcessorLoggerIsLevelEnabled(void* ctx, void* obj, int level);
+
+ [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorLoggerLog")]
+ public static extern void ProcessorLoggerLog(void* ctx, void* obj, int level, sbyte* messsage, sbyte* category, sbyte* errorInfo);
+
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamOutLong")]
public static extern long TargetInStreamOutLong(void* ctx, void* target, int opType, long memPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
index 51d9c74..6367e1e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
@@ -104,5 +104,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
internal void* affinityFunctionAssignPartitions;
internal void* affinityFunctionRemoveNode;
internal void* affinityFunctionDestroy;
+
+ internal void* loggerLog;
+ internal void* loggerIsLevelEnabled;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/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 223eb5b..493e061 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
+ using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading;
using Apache.Ignite.Core.Cache.Affinity;
@@ -38,11 +39,13 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using Apache.Ignite.Core.Impl.Datastream;
using Apache.Ignite.Core.Impl.Events;
using Apache.Ignite.Core.Impl.Handle;
+ using Apache.Ignite.Core.Impl.Log;
using Apache.Ignite.Core.Impl.Memory;
using Apache.Ignite.Core.Impl.Messaging;
using Apache.Ignite.Core.Impl.Resource;
using Apache.Ignite.Core.Impl.Services;
using Apache.Ignite.Core.Lifecycle;
+ using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Services;
using UU = UnmanagedUtils;
@@ -89,6 +92,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
[SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
private readonly IntPtr _cbsPtr;
+ /** Log. */
+ private readonly ILogger _log;
+
/** Error type: generic. */
private const int ErrGeneric = 1;
@@ -98,7 +104,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
/** Error type: attach. */
private const int ErrJvmAttach = 3;
- /** Opeartion: prepare .Net. */
+ /** Operation: prepare .Net. */
private const int OpPrepareDotNet = 1;
private delegate long CacheStoreCreateCallbackDelegate(void* target, long memPtr);
@@ -174,6 +180,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
private delegate void OnClientDisconnectedDelegate(void* target);
private delegate void OnClientReconnectedDelegate(void* target, bool clusterRestarted);
+ private delegate void LoggerLogDelegate(void* target, int level, sbyte* messageChars, int messageCharsLen, sbyte* categoryChars, int categoryCharsLen, sbyte* errorInfoChars, int errorInfoCharsLen, long memPtr);
+ private delegate bool LoggerIsLevelEnabledDelegate(void* target, int level);
+
private delegate long AffinityFunctionInitDelegate(void* target, long memPtr, void* baseFunc);
private delegate int AffinityFunctionPartitionDelegate(void* target, long ptr, long memPtr);
private delegate void AffinityFunctionAssignPartitionsDelegate(void* target, long ptr, long inMemPtr, long outMemPtr);
@@ -183,10 +192,14 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
private delegate void ConsoleWriteDelegate(sbyte* chars, int charsLen, bool isErr);
/// <summary>
- /// constructor.
+ /// Constructor.
/// </summary>
- public UnmanagedCallbacks()
+ /// <param name="log">Logger.</param>
+ public UnmanagedCallbacks(ILogger log)
{
+ Debug.Assert(log != null);
+ _log = log;
+
var cbs = new UnmanagedCallbackHandlers
{
target = IntPtr.Zero.ToPointer(), // Target is not used in .Net as we rely on dynamic FP creation.
@@ -270,7 +283,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
affinityFunctionPartition = CreateFunctionPointer((AffinityFunctionPartitionDelegate)AffinityFunctionPartition),
affinityFunctionAssignPartitions = CreateFunctionPointer((AffinityFunctionAssignPartitionsDelegate)AffinityFunctionAssignPartitions),
affinityFunctionRemoveNode = CreateFunctionPointer((AffinityFunctionRemoveNodeDelegate)AffinityFunctionRemoveNode),
- affinityFunctionDestroy = CreateFunctionPointer((AffinityFunctionDestroyDelegate)AffinityFunctionDestroy)
+ affinityFunctionDestroy = CreateFunctionPointer((AffinityFunctionDestroyDelegate)AffinityFunctionDestroy),
+
+ loggerLog = CreateFunctionPointer((LoggerLogDelegate)LoggerLog),
+ loggerIsLevelEnabled = CreateFunctionPointer((LoggerIsLevelEnabledDelegate)LoggerIsLevelEnabled)
};
_cbsPtr = Marshal.AllocHGlobal(UU.HandlersSize());
@@ -550,7 +566,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
/// <summary>
- /// Get comptue job using it's GC handle pointer.
+ /// Get compute job using it's GC handle pointer.
/// </summary>
/// <param name="jobPtr">Job pointer.</param>
/// <returns>Compute job.</returns>
@@ -883,7 +899,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using (var inStream = IgniteManager.Memory.Get(arg1).GetStream())
using (var outStream = IgniteManager.Memory.Get(arg2).GetStream())
{
- Ignition.OnPrepare(inStream, outStream, _handleRegistry);
+ Ignition.OnPrepare(inStream, outStream, _handleRegistry, _log);
return 0;
}
@@ -1131,6 +1147,40 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
});
}
+ private void LoggerLog(void* target, int level, sbyte* messageChars, int messageCharsLen, sbyte* categoryChars,
+ int categoryCharsLen, sbyte* errorInfoChars, int errorInfoCharsLen, long memPtr)
+ {
+ // When custom logger in .NET is not defined, Java should not call us.
+ Debug.Assert(!(_log is JavaLogger));
+
+ SafeCall(() =>
+ {
+ var message = IgniteUtils.Utf8UnmanagedToString(messageChars, messageCharsLen);
+ var category = IgniteUtils.Utf8UnmanagedToString(categoryChars, categoryCharsLen);
+ var nativeError = IgniteUtils.Utf8UnmanagedToString(errorInfoChars, errorInfoCharsLen);
+
+ Exception ex = null;
+
+ if (memPtr != 0 && _ignite != null)
+ {
+ using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
+ {
+ ex = _ignite.Marshaller.Unmarshal<Exception>(stream);
+ }
+ }
+
+ _log.Log((LogLevel) level, message, null, CultureInfo.InvariantCulture, category, nativeError, ex);
+ }, true);
+ }
+
+ private bool LoggerIsLevelEnabled(void* target, int level)
+ {
+ // When custom logger in .NET is not defined, Java should not call us.
+ Debug.Assert(!(_log is JavaLogger));
+
+ return SafeCall(() => _log.IsEnabled((LogLevel) level), true);
+ }
+
private static void ConsoleWrite(sbyte* chars, int charsLen, bool isErr)
{
try
@@ -1246,6 +1296,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
catch (Exception e)
{
+ _log.Error(e, "Failure in Java callback");
+
UU.ThrowToJava(_ctx.NativeContext, e);
}
}
@@ -1262,6 +1314,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
catch (Exception e)
{
+ _log.Error(e, "Failure in Java callback");
+
UU.ThrowToJava(_ctx.NativeContext, e);
return default(T);
@@ -1287,6 +1341,14 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
/// <summary>
+ /// Gets the log.
+ /// </summary>
+ public ILogger Log
+ {
+ get { return _log; }
+ }
+
+ /// <summary>
/// Create function pointer for the given function.
/// </summary>
private void* CreateFunctionPointer(Delegate del)
@@ -1323,6 +1385,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
_initEvent.Set();
+
+ ResourceProcessor.Inject(_log, grid);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index 0e9556d..f89caa8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -77,11 +77,12 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
#region NATIVE METHODS: PROCESSOR
internal static void IgnitionStart(UnmanagedContext ctx, string cfgPath, string gridName,
- bool clientMode)
+ bool clientMode, bool userLogger)
{
using (var mem = IgniteManager.Memory.Allocate().GetStream())
{
mem.WriteBool(clientMode);
+ mem.WriteBool(userLogger);
sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfgPath);
sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName);
@@ -377,6 +378,30 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
JNI.ProcessorGetCacheNames(target.Context, target.Target, memPtr);
}
+ internal static bool ProcessorLoggerIsLevelEnabled(IUnmanagedTarget target, int level)
+ {
+ return JNI.ProcessorLoggerIsLevelEnabled(target.Context, target.Target, level);
+ }
+
+ internal static void ProcessorLoggerLog(IUnmanagedTarget target, int level, string message, string category,
+ string errorInfo)
+ {
+ var message0 = IgniteUtils.StringToUtf8Unmanaged(message);
+ var category0 = IgniteUtils.StringToUtf8Unmanaged(category);
+ var errorInfo0 = IgniteUtils.StringToUtf8Unmanaged(errorInfo);
+
+ try
+ {
+ JNI.ProcessorLoggerLog(target.Context, target.Target, level, message0, category0, errorInfo0);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(new IntPtr(message0));
+ Marshal.FreeHGlobal(new IntPtr(category0));
+ Marshal.FreeHGlobal(new IntPtr(errorInfo0));
+ }
+ }
+
#endregion
#region NATIVE METHODS: TARGET
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Log/CategoryLogger.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Log/CategoryLogger.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Log/CategoryLogger.cs
new file mode 100644
index 0000000..2d7f876
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Log/CategoryLogger.cs
@@ -0,0 +1,82 @@
+\ufeff/*
+ * 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.Log
+{
+ using System;
+ using Apache.Ignite.Core.Impl.Common;
+
+ /// <summary>
+ /// Wrapping logger with a predefined category.
+ /// <para />
+ /// When <see cref="Log"/> method is called, and <c>category</c> parameter is null, predefined category
+ /// will be used.
+ /// </summary>
+ public class CategoryLogger : ILogger
+ {
+ /** Wrapped logger. */
+ private readonly ILogger _logger;
+
+ /** Category to use. */
+ private readonly string _category;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CategoryLogger"/> class.
+ /// </summary>
+ /// <param name="logger">The logger to wrap.</param>
+ /// <param name="category">The category.</param>
+ public CategoryLogger(ILogger logger, string category)
+ {
+ IgniteArgumentCheck.NotNull(logger, "log");
+
+ // If logger is already a CategoryLogger, get underlying logger instead to avoid unnecessary nesting.
+ var catLogger = logger as CategoryLogger;
+ _logger = catLogger != null ? catLogger._logger : logger;
+
+ _category = category;
+ }
+
+ /// <summary>
+ /// Logs the specified message.
+ /// </summary>
+ /// <param name="level">The level.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments to format <paramref name="message" />.
+ /// Can be null (formatting will not occur).</param>
+ /// <param name="formatProvider">The format provider. Can be null if <paramref name="args" /> is null.</param>
+ /// <param name="category">The logging category name.</param>
+ /// <param name="nativeErrorInfo">The native error information.</param>
+ /// <param name="ex">The exception. Can be null.</param>
+ public void Log(LogLevel level, string message, object[] args, IFormatProvider formatProvider, string category,
+ string nativeErrorInfo, Exception ex)
+ {
+ _logger.Log(level, message, args, formatProvider, category ?? _category, nativeErrorInfo, ex);
+ }
+
+ /// <summary>
+ /// Determines whether the specified log level is enabled.
+ /// </summary>
+ /// <param name="level">The level.</param>
+ /// <returns>
+ /// Value indicating whether the specified log level is enabled
+ /// </returns>
+ public bool IsEnabled(LogLevel level)
+ {
+ return _logger.IsEnabled(level);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Log/ILogger.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Log/ILogger.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Log/ILogger.cs
new file mode 100644
index 0000000..a2f2f20
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Log/ILogger.cs
@@ -0,0 +1,51 @@
+\ufeff/*
+ * 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.Log
+{
+ using System;
+
+ /// <summary>
+ /// Defines Ignite logging interface.
+ /// <para />
+ /// This interface only provides essential log methods.
+ /// All convenience overloads are in <see cref="LoggerExtensions"/>.
+ /// </summary>
+ public interface ILogger
+ {
+ /// <summary>
+ /// Logs the specified message.
+ /// </summary>
+ /// <param name="level">The level.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments to format <paramref name="message" />.
+ /// Can be null (formatting will not occur).</param>
+ /// <param name="formatProvider">The format provider. Can be null if <paramref name="args" /> is null.</param>
+ /// <param name="category">The logging category name.</param>
+ /// <param name="nativeErrorInfo">The native error information.</param>
+ /// <param name="ex">The exception. Can be null.</param>
+ void Log(LogLevel level, string message, object[] args, IFormatProvider formatProvider, string category,
+ string nativeErrorInfo, Exception ex);
+
+ /// <summary>
+ /// Determines whether the specified log level is enabled.
+ /// </summary>
+ /// <param name="level">The level.</param>
+ /// <returns>Value indicating whether the specified log level is enabled</returns>
+ bool IsEnabled(LogLevel level);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Log/LogLevel.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Log/LogLevel.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Log/LogLevel.cs
new file mode 100644
index 0000000..75694ab
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Log/LogLevel.cs
@@ -0,0 +1,53 @@
+\ufeff/*
+ * 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.Log
+{
+ using System;
+
+ /// <summary>
+ /// Defines log levels.
+ /// </summary>
+ [Serializable]
+ public enum LogLevel
+ {
+ /// <summary>
+ /// Trace log level.
+ /// </summary>
+ Trace = 0,
+
+ /// <summary>
+ /// Debug log level.
+ /// </summary>
+ Debug = 1,
+
+ /// <summary>
+ /// Info log level.
+ /// </summary>
+ Info = 2,
+
+ /// <summary>
+ /// Warning log level.
+ /// </summary>
+ Warn = 3,
+
+ /// <summary>
+ /// Error log level.
+ /// </summary>
+ Error = 4
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c9e254e/modules/platforms/dotnet/Apache.Ignite.Core/Log/LoggerExtensions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Log/LoggerExtensions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Log/LoggerExtensions.cs
new file mode 100644
index 0000000..93748e3
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Log/LoggerExtensions.cs
@@ -0,0 +1,320 @@
+\ufeff/*
+ * 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.Log
+{
+ using System;
+ using System.Globalization;
+ using Apache.Ignite.Core.Impl.Common;
+
+ /// <summary>
+ /// Extension methods for <see cref="ILogger" />
+ /// </summary>
+ public static class LoggerExtensions
+ {
+ // 4 overloads per level (message, message+args, ex+message, ex+message+args)
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Trace"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ public static void Trace(this ILogger logger, string message)
+ {
+ Log(logger, LogLevel.Trace, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Trace"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Trace(this ILogger logger, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Trace, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Trace"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ public static void Trace(this ILogger logger, Exception ex, string message)
+ {
+ Log(logger, LogLevel.Trace, ex, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Trace"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Trace(this ILogger logger, Exception ex, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Trace, ex, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Debug"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ public static void Debug(this ILogger logger, string message)
+ {
+ Log(logger, LogLevel.Debug, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Debug"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Debug(this ILogger logger, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Debug, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Debug"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ public static void Debug(this ILogger logger, Exception ex, string message)
+ {
+ Log(logger, LogLevel.Debug, ex, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Debug"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Debug(this ILogger logger, Exception ex, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Debug, ex, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Info"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ public static void Info(this ILogger logger, string message)
+ {
+ Log(logger, LogLevel.Info, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Info"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Info(this ILogger logger, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Info, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Info"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ public static void Info(this ILogger logger, Exception ex, string message)
+ {
+ Log(logger, LogLevel.Info, ex, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Info"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Info(this ILogger logger, Exception ex, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Info, ex, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Warn"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ public static void Warn(this ILogger logger, string message)
+ {
+ Log(logger, LogLevel.Warn, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Warn"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Warn(this ILogger logger, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Warn, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Warn"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ public static void Warn(this ILogger logger, Exception ex, string message)
+ {
+ Log(logger, LogLevel.Warn, ex, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Warn"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Warn(this ILogger logger, Exception ex, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Warn, ex, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Error"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ public static void Error(this ILogger logger, string message)
+ {
+ Log(logger, LogLevel.Error, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Error"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Error(this ILogger logger, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Error, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Error"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ public static void Error(this ILogger logger, Exception ex, string message)
+ {
+ Log(logger, LogLevel.Error, ex, message);
+ }
+
+ /// <summary>
+ /// Logs the message with <see cref="LogLevel.Error"/> level.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Error(this ILogger logger, Exception ex, string message, params object[] args)
+ {
+ Log(logger, LogLevel.Error, ex, message, args);
+ }
+
+ /// <summary>
+ /// Logs the message.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="level">The level.</param>
+ /// <param name="message">The message.</param>
+ public static void Log(this ILogger logger, LogLevel level, string message)
+ {
+ IgniteArgumentCheck.NotNull(logger, "logger");
+
+ logger.Log(level, message, null, null, null, null, null);
+ }
+
+ /// <summary>
+ /// Logs the message.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="level">The level.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Log(this ILogger logger, LogLevel level, string message, params object[] args)
+ {
+ IgniteArgumentCheck.NotNull(logger, "logger");
+
+ logger.Log(level, message, args, CultureInfo.InvariantCulture, null, null, null);
+ }
+
+ /// <summary>
+ /// Logs the message.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="level">The level.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ public static void Log(this ILogger logger, LogLevel level, Exception ex, string message)
+ {
+ IgniteArgumentCheck.NotNull(logger, "logger");
+
+ logger.Log(level, message, null, null, null, null, ex);
+ }
+
+ /// <summary>
+ /// Logs the message.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="level">The level.</param>
+ /// <param name="ex">The exception.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="args">The arguments.</param>
+ public static void Log(this ILogger logger, LogLevel level, Exception ex, string message, params object[] args)
+ {
+ IgniteArgumentCheck.NotNull(logger, "logger");
+
+ logger.Log(level, message, args, CultureInfo.InvariantCulture, null, null, ex);
+ }
+
+ /// <summary>
+ /// Gets the <see cref="CategoryLogger"/> with a specified category that wraps provided logger.
+ /// </summary>
+ /// <param name="logger">The logger.</param>
+ /// <param name="category">The category.</param>
+ /// <returns>Logger that always uses specified category.</returns>
+ public static ILogger GetLogger(this ILogger logger, string category)
+ {
+ IgniteArgumentCheck.NotNull(logger, "logger");
+
+ return new CategoryLogger(logger, category);
+ }
+ }
+}
\ No newline at end of file
[25/30] ignite git commit: Merge branch 'ignite-1.7.2' into
ignite-1.7.3
Posted by pt...@apache.org.
Merge branch 'ignite-1.7.2' into ignite-1.7.3
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b5902336
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b5902336
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b5902336
Branch: refs/heads/master
Commit: b5902336ba7a2c313b61050e38d7e033d310d55f
Parents: c7fa918 a4d7aa3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 3 10:47:13 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 3 10:47:13 2016 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 11 ++++++++---
.../IgniteCacheConfigVariationsFullApiTest.java | 7 ++++++-
...heAtomicClientOnlyMultiNodeFullApiSelfTest.java | 17 +++++++++++++++--
...acheAtomicNearOnlyMultiNodeFullApiSelfTest.java | 17 +++++++++++++++--
.../IgniteSessionStateStoreProviderTest.cs | 13 +++++++++++++
.../IgniteOutputCacheProvider.cs | 2 +-
.../IgniteSessionStateStoreProvider.cs | 8 +++++++-
.../dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs | 13 +++++++------
8 files changed, 72 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
[11/30] ignite git commit: Fixed incorrect test count calculation
leading to afterTestsStopped() not being called.
Posted by pt...@apache.org.
Fixed incorrect test count calculation leading to afterTestsStopped() not being called.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/78144c4c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/78144c4c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/78144c4c
Branch: refs/heads/master
Commit: 78144c4c9d6200ceef8b666a186039685f053381
Parents: 33d3494
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 28 16:52:13 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 28 16:52:13 2016 +0300
----------------------------------------------------------------------
.../ignite/testframework/IgniteTestSuite.java | 79 +++++++++++++++++---
.../testframework/junits/GridAbstractTest.java | 31 +++++++-
2 files changed, 94 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/78144c4c/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
index 7db9664..1cf69ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
@@ -29,6 +29,7 @@ import org.junit.internal.MethodSorter;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -134,7 +135,9 @@ public class IgniteTestSuite extends TestSuite {
Class superCls = theClass;
int testAdded = 0;
- int testIgnored = 0;
+ int testSkipped = 0;
+
+ LinkedList<Test> addedTests = new LinkedList<>();
for(List<String> names = new ArrayList<>(); Test.class.isAssignableFrom(superCls);
superCls = superCls.getSuperclass()) {
@@ -142,15 +145,29 @@ public class IgniteTestSuite extends TestSuite {
Method[] methods = MethodSorter.getDeclaredMethods(superCls);
for (Method each : methods) {
- if (addTestMethod(each, names, theClass, clsIgnore))
+ AddResult res = addTestMethod(each, names, theClass, clsIgnore);
+
+ if (res.added()) {
testAdded++;
+
+ addedTests.add(res.test());
+ }
else
- testIgnored++;
+ testSkipped++;
}
}
- if(testAdded == 0 && testIgnored == 0)
+ if(testAdded == 0 && testSkipped == 0)
addTest(warning("No tests found in " + theClass.getName()));
+
+ // Populate tests count.
+ for (Test test : addedTests) {
+ if (test instanceof GridAbstractTest) {
+ GridAbstractTest test0 = (GridAbstractTest)test;
+
+ test0.forceTestCount(addedTests.size());
+ }
+ }
}
}
@@ -161,20 +178,20 @@ public class IgniteTestSuite extends TestSuite {
* @param names Test name list.
* @param theClass Test class.
* @param clsIgnore Class ignore descriptor (if any).
- * @return Whether test method was added.
+ * @return Result.
*/
- private boolean addTestMethod(Method m, List<String> names, Class<?> theClass,
+ private AddResult addTestMethod(Method m, List<String> names, Class<?> theClass,
@Nullable IgnoreDescriptor clsIgnore) {
String name = m.getName();
if (names.contains(name))
- return false;
+ return new AddResult(false, null);
if (!isPublicTestMethod(m)) {
if (isTestMethod(m))
addTest(warning("Test method isn't public: " + m.getName() + "(" + theClass.getCanonicalName() + ")"));
- return false;
+ return new AddResult(false, null);
}
names.add(name);
@@ -197,18 +214,20 @@ public class IgniteTestSuite extends TestSuite {
addTest(test);
- return true;
+ return new AddResult(true, test);
}
}
else {
if (ignore == null) {
- addTest(createTest(theClass, name));
+ Test test = createTest(theClass, name);
+
+ addTest(test);
- return true;
+ return new AddResult(true, test);
}
}
- return false;
+ return new AddResult(false, null);
}
/**
@@ -337,6 +356,42 @@ public class IgniteTestSuite extends TestSuite {
}
/**
+ * Test add result.
+ */
+ private static class AddResult {
+ /** Result. */
+ private final boolean added;
+
+ /** Test */
+ private final Test test;
+
+ /**
+ * Constructor.
+ *
+ * @param added Result.
+ * @param test Test.
+ */
+ public AddResult(boolean added, Test test) {
+ this.added = added;
+ this.test = test;
+ }
+
+ /**
+ * @return Result.
+ */
+ public boolean added() {
+ return added;
+ }
+
+ /**
+ * @return Test.
+ */
+ public Test test() {
+ return test;
+ }
+ }
+
+ /**
* Test case simulating failure.
*/
private static class ForcedFailure extends TestCase {
http://git-wip-us.apache.org/repos/asf/ignite/blob/78144c4c/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 8d6fd07..aa90af0 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
@@ -161,6 +161,12 @@ public abstract class GridAbstractTest extends TestCase {
/** Force failure message. */
private String forceFailureMsg;
+ /** Whether test count is known is advance. */
+ private boolean forceTestCnt;
+
+ /** Number of tests. */
+ private int testCnt;
+
/**
*
*/
@@ -1770,6 +1776,15 @@ public abstract class GridAbstractTest extends TestCase {
}
/**
+ * Set test count.
+ */
+ public void forceTestCount(int cnt) {
+ testCnt = cnt;
+
+ forceTestCnt = true;
+ }
+
+ /**
* @throws Throwable If failed.
*/
@SuppressWarnings({"ProhibitedExceptionDeclared"})
@@ -2076,11 +2091,19 @@ public abstract class GridAbstractTest extends TestCase {
*/
public int getNumberOfTests() {
if (numOfTests == -1) {
- int cnt = 0;
+ GridAbstractTest this0 = GridAbstractTest.this;
+
+ int cnt;
- for (Method m : GridAbstractTest.this.getClass().getMethods())
- if (m.getName().startsWith("test") && Modifier.isPublic(m.getModifiers()))
- cnt++;
+ if (this0.forceTestCnt)
+ cnt = this0.testCnt;
+ else {
+ cnt = 0;
+
+ for (Method m : this0.getClass().getMethods())
+ if (m.getName().startsWith("test") && Modifier.isPublic(m.getModifiers()))
+ cnt++;
+ }
numOfTests = cnt;
}
[05/30] ignite git commit: IGNITE-3990: Moved failing Spring tests to
"ignore" module.
Posted by pt...@apache.org.
IGNITE-3990: Moved failing Spring tests to "ignore" module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d5953457
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d5953457
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d5953457
Branch: refs/heads/master
Commit: d595345765db2151ff432beecd478ce056393593
Parents: b9105df
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 28 15:08:38 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 28 15:08:38 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/testframework/IgniteTestSuite.java | 12 ++++--------
modules/ignored-tests/pom.xml | 7 +++++++
.../ignite/testsuites/IgniteIgnoredTestSuite.java | 3 +++
.../ignite/p2p/GridP2PUserVersionChangeSelfTest.java | 7 ++-----
.../testsuites/IgniteResourceSelfTestSuite.java | 11 ++++++-----
.../ignite/testsuites/IgniteSpringTestSuite.java | 15 ++++++++-------
6 files changed, 30 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5953457/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
index 6fc7917..6dad032 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
@@ -101,16 +101,12 @@ public class IgniteTestSuite extends TestSuite {
setName(name);
}
- /**
- * Adds a test to the suite.
- */
- @Override public void addTest(Test test) {
- super.addTest(test);
- }
-
/** {@inheritDoc} */
@Override public void addTestSuite(Class<? extends TestCase> testClass) {
- addTest(new IgniteTestSuite(testClass, ignoredOnly));
+ IgniteTestSuite suite = new IgniteTestSuite(testClass, ignoredOnly);
+
+ if (suite.testCount() > 0)
+ addTest(suite);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5953457/modules/ignored-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/pom.xml b/modules/ignored-tests/pom.xml
index 661e237..336485c 100644
--- a/modules/ignored-tests/pom.xml
+++ b/modules/ignored-tests/pom.xml
@@ -102,6 +102,13 @@
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-spring</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5953457/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
index 97f65c5..2188cd6 100644
--- a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
+++ b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
@@ -43,6 +43,9 @@ public class IgniteIgnoredTestSuite extends TestSuite {
/* --- JTA --- */
suite.addTest(IgniteJtaTestSuite.suite());
+ /* --- Spring --- */
+ suite.addTest(IgniteSpringTestSuite.suite());
+
/* --- WEB SESSIONS --- */
suite.addTest(IgniteWebSessionSelfTestSuite.suite());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5953457/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
index 8efa440..0b32b04 100644
--- a/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.testframework.GridTestExternalClassLoader;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.config.GridTestProperties;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testsuites.IgniteIgnore;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
@@ -282,14 +283,10 @@ public class GridP2PUserVersionChangeSelfTest extends GridCommonAbstractTest {
}
/**
- * TODO: IGNITE-604.
- *
* @throws Exception If failed.
*/
+ @IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-604", forceFailure = true)
public void testCacheRedeployVersionChangeContinuousMode() throws Exception {
- // Build execution timeout if try to run test on TC.
- fail("https://issues.apache.org/jira/browse/IGNITE-604");
-
depMode = DeploymentMode.CONTINUOUS;
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5953457/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteResourceSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteResourceSelfTestSuite.java b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteResourceSelfTestSuite.java
index 742190b..e120aaa 100644
--- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteResourceSelfTestSuite.java
+++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteResourceSelfTestSuite.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.processors.resource.GridLoggerInjectionSelfTes
import org.apache.ignite.internal.processors.resource.GridResourceProcessorSelfTest;
import org.apache.ignite.internal.processors.resource.GridServiceInjectionSelfTest;
import org.apache.ignite.internal.processors.resource.GridSpringResourceInjectionSelfTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
/**
* Ignite resource injection test Suite.
@@ -33,12 +34,12 @@ public class IgniteResourceSelfTestSuite extends TestSuite {
* @throws Exception If failed.
*/
public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("Ignite Resource Injection Test Suite");
+ TestSuite suite = new IgniteTestSuite("Ignite Resource Injection Test Suite");
- suite.addTest(new TestSuite(GridResourceProcessorSelfTest.class));
- suite.addTest(new TestSuite(GridLoggerInjectionSelfTest.class));
- suite.addTest(new TestSuite(GridServiceInjectionSelfTest.class));
- suite.addTest(new TestSuite(GridSpringResourceInjectionSelfTest.class));
+ suite.addTestSuite(GridResourceProcessorSelfTest.class);
+ suite.addTestSuite(GridLoggerInjectionSelfTest.class);
+ suite.addTestSuite(GridServiceInjectionSelfTest.class);
+ suite.addTestSuite(GridSpringResourceInjectionSelfTest.class);
return suite;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5953457/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
index c4a4b75..fff8108 100644
--- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
+++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
@@ -33,6 +33,7 @@ import org.apache.ignite.p2p.GridP2PUserVersionChangeSelfTest;
import org.apache.ignite.spring.IgniteExcludeInConfigurationTest;
import org.apache.ignite.spring.IgniteStartFromStreamConfigurationTest;
import org.apache.ignite.spring.injection.GridServiceInjectionSpringResourceTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
import org.apache.ignite.transactions.spring.GridSpringTransactionManagerSelfTest;
import org.apache.ignite.transactions.spring.SpringTransactionManagerContextInjectionTest;
@@ -45,23 +46,23 @@ public class IgniteSpringTestSuite extends TestSuite {
* @throws Exception Thrown in case of the failure.
*/
public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("Spring Test Suite");
+ TestSuite suite = new IgniteTestSuite("Spring Test Suite");
suite.addTestSuite(GridSpringBeanSerializationSelfTest.class);
suite.addTestSuite(GridFactorySelfTest.class);
suite.addTest(IgniteResourceSelfTestSuite.suite());
- suite.addTest(new TestSuite(IgniteExcludeInConfigurationTest.class));
+ suite.addTestSuite(IgniteExcludeInConfigurationTest.class);
// Tests moved to this suite since they require Spring functionality.
- suite.addTest(new TestSuite(GridP2PUserVersionChangeSelfTest.class));
+ suite.addTestSuite(GridP2PUserVersionChangeSelfTest.class);
- suite.addTest(new TestSuite(GridSpringCacheManagerSelfTest.class));
+ suite.addTestSuite(GridSpringCacheManagerSelfTest.class);
- suite.addTest(new TestSuite(IgniteDynamicCacheConfigTest.class));
+ suite.addTestSuite(IgniteDynamicCacheConfigTest.class);
- suite.addTest(new TestSuite(IgniteStartFromStreamConfigurationTest.class));
+ suite.addTestSuite(IgniteStartFromStreamConfigurationTest.class);
suite.addTestSuite(CacheSpringStoreSessionListenerSelfTest.class);
@@ -70,7 +71,7 @@ public class IgniteSpringTestSuite extends TestSuite {
suite.addTestSuite(CachePojoStoreXmlSelfTest.class);
suite.addTestSuite(CachePojoStoreXmlWithSqlEscapeSelfTest.class);
- suite.addTest(new TestSuite(GridSpringTransactionManagerSelfTest.class));
+ suite.addTestSuite(GridSpringTransactionManagerSelfTest.class);
suite.addTestSuite(GridServiceInjectionSpringResourceTest.class);
[30/30] ignite git commit: Merge branch community/ignite-1.7.3
Posted by pt...@apache.org.
Merge branch community/ignite-1.7.3
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e7b13cc5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e7b13cc5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e7b13cc5
Branch: refs/heads/master
Commit: e7b13cc5c4111be990e51e7633a8fb10f6795489
Parents: e7f3532 ae4ae71
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Oct 3 12:55:06 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Oct 3 12:55:06 2016 +0300
----------------------------------------------------------------------
.../client/ClientReconnectionSelfTest.java | 4 +-
.../client/router/TcpSslRouterSelfTest.java | 7 +-
.../client/suite/IgniteClientTestSuite.java | 71 +++----
.../processors/cache/GridCacheAdapter.java | 7 +
.../distributed/near/GridNearCacheAdapter.java | 7 +
.../query/GridCacheQueryMetricsAdapter.java | 12 +-
.../platform/PlatformConfigurationEx.java | 6 +
.../cpp/PlatformCppConfigurationEx.java | 5 +
.../dotnet/PlatformDotNetConfigurationEx.java | 5 +
.../cache/VisorCacheResetQueryMetricsTask.java | 69 +++++++
.../cache/GridCacheAbstractFullApiSelfTest.java | 11 +-
.../IgniteCacheConfigVariationsFullApiTest.java | 7 +-
...niteCacheExpireAndUpdateConsistencyTest.java | 7 +
.../GridCacheBinaryObjectsAbstractSelfTest.java | 6 +
...tomicClientOnlyMultiNodeFullApiSelfTest.java | 17 +-
...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 17 +-
.../ignite/testframework/IgniteTestSuite.java | 203 ++++++++++++++++---
.../testframework/junits/GridAbstractTest.java | 31 ++-
.../apache/ignite/testsuites/IgniteIgnore.java | 2 +-
modules/ignored-tests/pom.xml | 128 +++++++++++-
.../testsuites/IgniteIgnoredTestSuite.java | 9 +
.../CacheAbstractQueryMetricsSelfTest.java | 6 +-
...titionedCacheJtaLookupClassNameSelfTest.java | 4 +-
.../ignite/testsuites/IgniteJtaTestSuite.java | 3 +-
.../IgniteSessionStateStoreProviderTest.cs | 13 ++
.../IgniteOutputCacheProvider.cs | 2 +-
.../IgniteSessionStateStoreProvider.cs | 8 +-
.../Apache.Ignite.AspNet/Impl/ConfigUtil.cs | 13 +-
.../Apache.Ignite.Core.Tests.csproj | 6 +
.../IgniteConfigurationSection.xsd | 12 ++
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 1 +
.../p2p/GridP2PUserVersionChangeSelfTest.java | 7 +-
.../testsuites/IgniteResourceSelfTestSuite.java | 11 +-
.../testsuites/IgniteSpringTestSuite.java | 15 +-
34 files changed, 601 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
index a58510d,97f0866..a5f9e13
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformConfigurationEx.java
@@@ -17,8 -17,8 +17,9 @@@
package org.apache.ignite.internal.processors.platform;
+import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtension;
+ import org.apache.ignite.internal.logger.platform.PlatformLogger;
import org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
import org.jetbrains.annotations.Nullable;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index aa74939,2c6150c..c1c4953
--- 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
@@@ -270,6 -249,6 +270,12 @@@
<Content Include="Config\Log\custom-log.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
++ <Content Include="Config\Log\dotnet-log4j.xml">
++ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
++ </Content>
++ <Content Include="Config\Log\custom-log.xml">
++ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
++ </Content>
<Content Include="Config\spring-test.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 40e3055,916fd20..f17c896
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@@ -1060,42 -349,15 +1060,54 @@@
</xs:complexType>
</xs:element>
<xs:element name="transactionConfiguration" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Transaction configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="defaultTransactionConcurrency" type="transactionConcurrency">
+ <xs:annotation>
+ <xs:documentation>Cache transaction concurrency to use when one is not explicitly specified.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="defaultTransactionIsolation" type="transactionIsolation">
+ <xs:annotation>
+ <xs:documentation>Cache transaction isolation to use when one is not explicitly specified.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="defaultTimeout" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ Cache transaction timeout to use when one is not explicitly specified. TimeSpan.Zero for infinite timeout.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="pessimisticTransactionLogSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>
+ Size of pessimistic transactions log stored on node in order to recover transaction commit if originating node has left grid before it has sent all messages to transaction nodes. 0 for unlimited.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="pessimisticTransactionLogLinger" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Delay after which pessimistic recovery entries will be cleaned up for failed node.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="logger" minOccurs="0">
++ <xs:annotation>
++ <xs:documentation>The logger. If no logger is set, logging is delegated to Java, which uses the logger defined in Spring XML (if present) or logs to console otherwise.</xs:documentation>
++ </xs:annotation>
+ <xs:complexType>
- <xs:attribute name="defaultTransactionConcurrency" type="xs:string" />
- <xs:attribute name="defaultTransactionIsolation" type="xs:string" />
- <xs:attribute name="defaultTimeout" type="xs:string" />
- <xs:attribute name="pessimisticTransactionLogSize" type="xs:int" />
- <xs:attribute name="pessimisticTransactionLogLinger" type="xs:string" />
++ <xs:attribute name="type" type="xs:string" use="required">
++ <xs:annotation>
++ <xs:documentation>Assembly-qualified type name.</xs:documentation>
++ </xs:annotation>
++ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="logger" minOccurs="0">
<xs:annotation>
<xs:documentation>The logger. If no logger is set, logging is delegated to Java, which uses the logger defined in Spring XML (if present) or logs to console otherwise.</xs:documentation>
</xs:annotation>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7b13cc5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index e623969,493e061..1b58d17
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@@ -21,8 -21,8 +21,9 @@@ namespace Apache.Ignite.Core.Impl.Unman
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
+ using System.Globalization;
using System.IO;
+ using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading;
using Apache.Ignite.Core.Cache.Affinity;
[10/30] ignite git commit: Merge remote-tracking branch
'community/ignite-1.6.9' into ignite-1.6.9
Posted by pt...@apache.org.
Merge remote-tracking branch 'community/ignite-1.6.9' into ignite-1.6.9
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/33d34941
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/33d34941
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/33d34941
Branch: refs/heads/master
Commit: 33d34941390c00e8d6a2488e8f2e11e6abba8a01
Parents: 74d2fc2 d2563da
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 15:54:52 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 15:54:52 2016 +0300
----------------------------------------------------------------------
.../client/ClientReconnectionSelfTest.java | 4 +-
.../client/router/TcpSslRouterSelfTest.java | 7 +-
.../client/suite/IgniteClientTestSuite.java | 71 ++++++------
.../ignite/testframework/IgniteTestSuite.java | 116 ++++++++++++++++---
.../apache/ignite/testsuites/IgniteIgnore.java | 2 +-
modules/ignored-tests/pom.xml | 46 ++++++++
.../testsuites/IgniteIgnoredTestSuite.java | 5 +-
7 files changed, 192 insertions(+), 59 deletions(-)
----------------------------------------------------------------------