public void TestAttributeConfigurationQuery() { var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { BinaryConfiguration = new BinaryConfiguration( typeof(AttributeQueryPerson), typeof(AttributeQueryAddress)) }; using (var ignite = Ignition.Start(cfg)) { var cache = ignite.GetOrCreateCache <int, AttributeQueryPerson>(new CacheConfiguration(CacheName, new QueryEntity(typeof(int), typeof(AttributeQueryPerson)))); Assert.IsNotNull(cache); cache[1] = new AttributeQueryPerson("Arnold", 10) { Address = new AttributeQueryAddress { Country = "USA", Street = "Pine Tree road", Zip = 1 } }; cache[2] = new AttributeQueryPerson("John", 20); #pragma warning disable 618 using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "age > ? and age < ? and birthday > ? and birthday < ?", 10, 30, DateTime.UtcNow.AddYears(-21), DateTime.UtcNow.AddYears(-19)))) { Assert.AreEqual(2, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "salary > ?", 10))) { Assert.AreEqual(2, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Country = ?", "USA"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Zip = ?", 1))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } #pragma warning restore 618 using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Ar*"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Pin*"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } } }
public void TestAttributeConfigurationQuery() { var cfg = new IgniteConfiguration { JvmOptions = TestUtils.TestJavaOptions(), JvmClasspath = TestUtils.CreateTestClasspath(), BinaryConfiguration = new BinaryConfiguration( typeof(AttributeQueryPerson), typeof(AttributeQueryAddress)), }; using (var ignite = Ignition.Start(cfg)) { var cache = ignite.GetOrCreateCache <int, AttributeQueryPerson>(new CacheConfiguration(CacheName, typeof(AttributeQueryPerson))); Assert.IsNotNull(cache); cache[1] = new AttributeQueryPerson("Arnold", 10) { Address = new AttributeQueryAddress { Country = "USA", Street = "Pine Tree road", Zip = 1 } }; cache[2] = new AttributeQueryPerson("John", 20); using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "age > ?", 10))) { Assert.AreEqual(2, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "salary > ?", 10))) { Assert.AreEqual(2, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Country = ?", "USA"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Zip = ?", 1))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Ar*"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Pin*"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } } }
public void TestAttributeConfigurationQuery() { var cfg = new IgniteConfiguration { JvmOptions = TestUtils.TestJavaOptions(), JvmClasspath = TestUtils.CreateTestClasspath(), BinaryConfiguration = new BinaryConfiguration( typeof (AttributeQueryPerson), typeof (AttributeQueryAddress)), }; using (var ignite = Ignition.Start(cfg)) { var cache = ignite.GetOrCreateCache<int, AttributeQueryPerson>(new CacheConfiguration(CacheName, typeof (AttributeQueryPerson))); Assert.IsNotNull(cache); cache[1] = new AttributeQueryPerson("Arnold", 10) { Address = new AttributeQueryAddress {Country = "USA", Street = "Pine Tree road", Zip = 1} }; cache[2] = new AttributeQueryPerson("John", 20); using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "age > ?", 10))) { Assert.AreEqual(2, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "salary > ?", 10))) { Assert.AreEqual(2, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Country = ?", "USA"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Zip = ?", 1))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Ar*"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Pin*"))) { Assert.AreEqual(1, cursor.GetAll().Single().Key); } } }