1 /*** 2 * Copyright 2003-2010 Terracotta, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package net.sf.ehcache; 18 19 import junit.framework.Assert; 20 import org.junit.After; 21 import org.junit.Before; 22 import org.junit.Test; 23 import org.junit.Ignore; 24 25 import java.io.File; 26 27 /*** 28 * These tests require a Terracotta server running on localhost. 29 * <p/> 30 * If running this interactively, start terracotta with mvn tc:start. 31 * To stop mvn tc:stop 32 * <p/> 33 * This test is set up in Maven as an integration test. Terracotta is set up to start and stop pre and post the 34 * integration tests phase. 35 * 36 * @author Greg Luck 37 */ 38 @Ignore("Client hangs") 39 public class TerracottaIntegrationTest { 40 41 /*** 42 * the CacheManager instance 43 */ 44 protected CacheManager manager; 45 46 /*** 47 * setup test 48 */ 49 @Before 50 public void setUp() throws Exception { 51 manager = new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + File.separator 52 + "terracotta" + File.separator + "ehcache-terracotta-localhost.xml"); 53 } 54 55 /*** 56 * teardown 57 */ 58 @After 59 public void tearDown() throws Exception { 60 if (manager != null) { 61 manager.shutdown(); 62 } 63 } 64 65 /*** 66 * Tests that we can put something into a cache with Terracotta" 67 */ 68 @Test 69 public void testIntegration() { 70 Cache cache1 = manager.getCache("clustered-1"); 71 manager.addCache("defaults"); 72 Cache defaults = manager.getCache("defaults"); 73 74 cache1.put(new Element("key1", "value1")); 75 Assert.assertEquals("value1", cache1.get("key1")); 76 } 77 }