# ignite-sql-tests: fixed tests - removed dependecy from example-cache config.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/78d77bcb Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/78d77bcb Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/78d77bcb Branch: refs/heads/ignite-432 Commit: 78d77bcb98347566e4d8a606c62a18d62fb2bb07 Parents: 59528bd Author: AKuznetsov <akuznet...@gridgain.com> Authored: Mon Mar 16 14:59:35 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Mon Mar 16 14:59:35 2015 +0700 ---------------------------------------------------------------------- .../scalar/src/test/resources/spring-cache.xml | 70 +++++++++++++------- .../tests/ScalarAffinityRoutingSpec.scala | 6 +- .../ignite/scalar/tests/ScalarCacheSpec.scala | 4 +- 3 files changed, 54 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/78d77bcb/modules/scalar/src/test/resources/spring-cache.xml ---------------------------------------------------------------------- diff --git a/modules/scalar/src/test/resources/spring-cache.xml b/modules/scalar/src/test/resources/spring-cache.xml index a04bfa9..fb91fe5 100644 --- a/modules/scalar/src/test/resources/spring-cache.xml +++ b/modules/scalar/src/test/resources/spring-cache.xml @@ -24,20 +24,41 @@ <property name="localHost" value="127.0.0.1"/> <property name="cacheConfiguration"> - <bean class="org.apache.ignite.configuration.CacheConfiguration"> - <property name="cacheMode" value="PARTITIONED"/> - <property name="atomicityMode" value="TRANSACTIONAL"/> - <property name="distributionMode" value="NEAR_PARTITIONED"/> - <property name="writeSynchronizationMode" value="FULL_SYNC"/> - <property name="indexedTypes"> - <list> - <value>java.lang.Integer</value> - <value>org.apache.ignite.scalar.tests.ObjectValue</value> - </list> - </property> + <list> + <bean class="org.apache.ignite.configuration.CacheConfiguration"> + <property name="cacheMode" value="PARTITIONED"/> + <property name="atomicityMode" value="TRANSACTIONAL"/> + <property name="distributionMode" value="NEAR_PARTITIONED"/> + <property name="writeSynchronizationMode" value="FULL_SYNC"/> + <property name="indexedTypes"> + <list> + <value>java.lang.Integer</value> + <value>org.apache.ignite.scalar.tests.ObjectValue</value> + </list> + </property> - <property name="backups" value="1"/> - </bean> + <property name="backups" value="1"/> + </bean> + + <!-- Partitioned cache example configuration (Atomic mode). --> + <bean parent="cache-template"> + <property name="name" value="partitioned"/> + <property name="cacheMode" value="PARTITIONED"/> + <property name="atomicityMode" value="ATOMIC"/> + <property name="distributionMode" value="PARTITIONED_ONLY"/> + <property name="backups" value="1"/> + </bean> + + <!-- Partitioned cache example configuration (Transactional mode). --> + <bean parent="cache-template"> + <property name="name" value="partitioned_tx"/> + <property name="cacheMode" value="PARTITIONED"/> + <property name="atomicityMode" value="TRANSACTIONAL"/> + <property name="distributionMode" value="NEAR_PARTITIONED"/> + <property name="backups" value="1"/> + </bean> + + </list> </property> <property name="discoverySpi"> @@ -46,16 +67,7 @@ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> <property name="addresses"> <list> - <value>127.0.0.1:47500</value> - <value>127.0.0.1:47501</value> - <value>127.0.0.1:47502</value> - <value>127.0.0.1:47503</value> - <value>127.0.0.1:47504</value> - <value>127.0.0.1:47505</value> - <value>127.0.0.1:47506</value> - <value>127.0.0.1:47507</value> - <value>127.0.0.1:47508</value> - <value>127.0.0.1:47509</value> + <value>127.0.0.1:47500..47509</value> </list> </property> </bean> @@ -63,4 +75,16 @@ </bean> </property> </bean> + + <!-- Template for all example cache configurations. --> + <bean id="cache-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration"> + <!-- Initial cache size. --> + <property name="startSize" value="3000000"/> + + <!-- Set synchronous rebalancing (default is asynchronous). --> + <property name="rebalanceMode" value="SYNC"/> + + <!-- Set to FULL_SYNC for examples, default is PRIMARY_SYNC. --> + <property name="writeSynchronizationMode" value="FULL_SYNC"/> + </bean> </beans> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/78d77bcb/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarAffinityRoutingSpec.scala ---------------------------------------------------------------------- diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarAffinityRoutingSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarAffinityRoutingSpec.scala index 13b09eb..5f9c531 100644 --- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarAffinityRoutingSpec.scala +++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarAffinityRoutingSpec.scala @@ -29,10 +29,12 @@ import org.scalatest.junit.JUnitRunner */ @RunWith(classOf[JUnitRunner]) class ScalarAffinityRoutingSpec extends FlatSpec with ShouldMatchers with BeforeAndAfterAll { + private val CFG = "modules/scalar/src/test/resources/spring-cache.xml" + /** Cache name. */ private val CACHE_NAME = "partitioned_tx" - "affinityRun$ method" should "run correctly" in scalar("examples/config/example-cache.xml") { + "affinityRun$ method" should "run correctly" in scalar(CFG) { val c = cache$[Int, Int](CACHE_NAME).get // c += (0 -> 0) @@ -48,7 +50,7 @@ class ScalarAffinityRoutingSpec extends FlatSpec with ShouldMatchers with Before assert(cnt.get === 3) } - "affinityRunAsync$ method" should "run correctly" in scalar("examples/config/example-cache.xml") { + "affinityRunAsync$ method" should "run correctly" in scalar(CFG) { val c = cache$[Int, Int](CACHE_NAME).get // c += (0 -> 0) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/78d77bcb/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala ---------------------------------------------------------------------- diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala index 565b68f..0fde48f 100644 --- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala +++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala @@ -32,10 +32,12 @@ import scala.collection.JavaConversions._ */ @RunWith(classOf[JUnitRunner]) class ScalarCacheSpec extends FlatSpec with ShouldMatchers { + private val CFG = "modules/scalar/src/test/resources/spring-cache.xml" + behavior of "Scalar cache" it should "work properly via Java APIs" in { - scalar("examples/config/example-cache.xml") { + scalar(CFG) { registerListener() val c = cache$[Int, Int]("partitioned").get