/* * Copyright 2011-2017 the original author or authors. * * Licensed 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.springframework.data.redis.connection.jedis; import org.junit.After; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.AbstractConnectionTransactionIntegrationTests; import org.springframework.data.redis.test.util.RelaxedJUnit4ClassRunner; import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; /** * Integration test of {@link JedisConnection} transaction functionality. * <p> * Each method of {@link JedisConnection} behaves differently if executed with a transaction (i.e. between multi and * exec or discard calls), so this test covers those branching points * * @author Jennifer Hickey */ @RunWith(RelaxedJUnit4ClassRunner.class) @ContextConfiguration("JedisConnectionIntegrationTests-context.xml") public class JedisConnectionTransactionIntegrationTests extends AbstractConnectionTransactionIntegrationTests { @After public void tearDown() { try { connection.flushAll(); connection.close(); } catch (Exception e) { // Jedis leaves some incomplete data in OutputStream on NPE caused // by null key/value tests // Attempting to close the connection will result in error on // sending QUIT to Redis } connection = null; } @Ignore("Jedis issue: Transaction tries to return String instead of List<String>") public void testGetConfig() {} // Unsupported Ops @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testScriptLoadEvalSha() { super.testScriptLoadEvalSha(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalShaArrayStrings() { super.testEvalShaArrayStrings(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalShaArrayBytes() { super.testEvalShaArrayBytes(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalShaNotFound() { super.testEvalShaNotFound(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalShaArrayError() { super.testEvalShaArrayError(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalArrayScriptError() { super.testEvalArrayScriptError(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnString() { super.testEvalReturnString(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnNumber() { super.testEvalReturnNumber(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnSingleOK() { super.testEvalReturnSingleOK(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnSingleError() { super.testEvalReturnSingleError(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnFalse() { super.testEvalReturnFalse(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnTrue() { super.testEvalReturnTrue(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnArrayStrings() { super.testEvalReturnArrayStrings(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnArrayNumbers() { super.testEvalReturnArrayNumbers(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnArrayOKs() { super.testEvalReturnArrayOKs(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnArrayFalses() { super.testEvalReturnArrayFalses(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testEvalReturnArrayTrues() { super.testEvalReturnArrayTrues(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testScriptExists() { super.testScriptExists(); } @IfProfileValue(name = "redisVersion", value = "2.6+") @Test(expected = UnsupportedOperationException.class) public void testScriptKill() { connection.scriptKill(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testScriptFlush() { connection.scriptFlush(); } @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testInfoBySection() throws Exception { super.testInfoBySection(); } @Test(expected = UnsupportedOperationException.class) public void testZAddMultiple() { super.testZAddMultiple(); } @Test(expected = InvalidDataAccessApiUsageException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testRestoreBadData() { super.testRestoreBadData(); } @Test(expected = InvalidDataAccessApiUsageException.class) @IfProfileValue(name = "redisVersion", value = "2.6+") public void testRestoreExistingKey() { super.testRestoreExistingKey(); } @Test(expected = UnsupportedOperationException.class) // DATAREDIS-269 public void clientSetNameWorksCorrectly() { super.clientSetNameWorksCorrectly(); } @Override @Test(expected = UnsupportedOperationException.class) // DATAREDIS-268 public void testListClientsContainsAtLeastOneElement() { super.testListClientsContainsAtLeastOneElement(); } }