ignite-615 ignite-616 partial test implementation
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1d77b1b2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1d77b1b2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1d77b1b2 Branch: refs/heads/ignite-615-616 Commit: 1d77b1b2bef3ba9aa16f981d3a0a78571a5c0275 Parents: d19e6c6 Author: avinogradov <avinogra...@gridgain.com> Authored: Fri Mar 27 18:06:41 2015 +0300 Committer: avinogradov <avinogra...@gridgain.com> Committed: Fri Mar 27 18:06:41 2015 +0300 ---------------------------------------------------------------------- ...bernateBlobStoreNodeRestartAbstractTest.java | 40 +++++++++ ...IgniteCacheStoreNodeRestartAbstractTest.java | 92 ++++++++++++++++++++ 2 files changed, 132 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d77b1b2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheHibernateBlobStoreNodeRestartAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheHibernateBlobStoreNodeRestartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheHibernateBlobStoreNodeRestartAbstractTest.java new file mode 100644 index 0000000..6efe423 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheHibernateBlobStoreNodeRestartAbstractTest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.integration; + +import org.apache.ignite.cache.*; +import org.apache.ignite.cache.store.*; +import org.apache.ignite.configuration.*; + +public class IgniteCacheHibernateBlobStoreNodeRestartAbstractTest extends IgniteCacheStoreNodeRestartAbstractTest { + @Override protected CacheStore getStore() { + return null; + } + + @Override protected CacheMode cacheMode() { + return null; + } + + @Override protected CacheAtomicityMode atomicityMode() { + return null; + } + + @Override protected NearCacheConfiguration nearConfiguration() { + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d77b1b2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreNodeRestartAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreNodeRestartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreNodeRestartAbstractTest.java new file mode 100644 index 0000000..89a203f --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreNodeRestartAbstractTest.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.integration; + +import org.apache.ignite.cache.store.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.*; + +import java.io.*; + +public abstract class IgniteCacheStoreNodeRestartAbstractTest extends IgniteCacheAbstractTest { + + /** */ + protected static final String CACHE_NAME1 = "cache1"; + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + CacheStore store = getStore(); // Use the same store instance for both caches. + + assert cfg.getCacheConfiguration().length == 1; + + CacheConfiguration ccfg0 = cfg.getCacheConfiguration()[0]; + + ccfg0.setReadThrough(true); + ccfg0.setWriteThrough(true); + + ccfg0.setCacheStoreFactory(singletonFactory(store)); + + CacheConfiguration ccfg1 = cacheConfiguration(gridName); + + ccfg1.setReadThrough(true); + ccfg1.setWriteThrough(true); + + ccfg1.setName(CACHE_NAME1); + + ccfg1.setCacheStoreFactory(singletonFactory(store)); + + cfg.setCacheConfiguration(ccfg0, ccfg1); + + return cfg; + } + + @Override protected int gridCount() { + return 2; + } + + /** */ + protected abstract CacheStore getStore(); + + /** + * @throws Exception If failed. + */ + public void testStoreSession() throws Exception { + grid(0).cache(CACHE_NAME1).put("key1", new UserObject("key1")); + stopGrid(0); + startGrid(0); + grid(1).cache(CACHE_NAME1).get("key1"); + } + + private static class UserObject implements Serializable{ + private String field; + + public UserObject(String field) { + this.field = field; + } + + public UserObject() { + } + + public String getField() { + return field; + } + } +}