DonalEvans commented on a change in pull request #6908: URL: https://github.com/apache/geode/pull/6908#discussion_r719709026
########## File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/LolWutIntegrationTest.java ########## @@ -0,0 +1,170 @@ +/* + * 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.geode.redis.internal.executor.server; + +import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.After; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.commands.ProtocolCommand; +import redis.clients.jedis.util.SafeEncoder; + +import org.apache.geode.internal.serialization.KnownVersion; +import org.apache.geode.redis.GeodeRedisServerRule; +import org.apache.geode.redis.RedisIntegrationTest; +import org.apache.geode.redis.internal.netty.Coder; +import org.apache.geode.test.awaitility.GeodeAwaitility; + +public class LolWutIntegrationTest implements RedisIntegrationTest { + private static final int REDIS_CLIENT_TIMEOUT = + Math.toIntExact(GeodeAwaitility.getTimeout().toMillis()); + private static final String GEODE_VERSION_STRING = KnownVersion.getCurrentVersion().toString(); + private static final int DEFAULT_MAZE_HEIGHT = 10 + 2; // Top & bottom walls, version string + private static final int MAX_MAZE_HEIGHT = (1024 * 1024) + 2; + private Jedis jedis; + + @ClassRule + public static GeodeRedisServerRule server = new GeodeRedisServerRule() + .withProperty(LOG_LEVEL, "info"); + + @Override + public int getPort() { + return server.getPort(); + } + + @Before + public void setUp() { + jedis = new Jedis("localhost", getPort(), REDIS_CLIENT_TIMEOUT); + } + + @After + public void tearDown() { + jedis.flushAll(); + jedis.close(); + } + + @Test + public void shouldReturnGeodeVersion() { + String actualResult = Coder.bytesToString((byte[]) jedis.sendCommand(new ProtocolCommand() { + @Override + public byte[] getRaw() { + return SafeEncoder.encode("lolwut"); + } + })); Review comment: This can be simplified to: ``` String actualResult = Coder.bytesToString((byte[]) jedis.sendCommand( () -> SafeEncoder.encode("lolwut"))); ``` Similarly, other uses of `new ProtocolCommand` in this class can be replaced with lambdas. ########## File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/LolWutIntegrationTest.java ########## @@ -0,0 +1,170 @@ +/* + * 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.geode.redis.internal.executor.server; + +import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.After; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.commands.ProtocolCommand; +import redis.clients.jedis.util.SafeEncoder; + +import org.apache.geode.internal.serialization.KnownVersion; +import org.apache.geode.redis.GeodeRedisServerRule; +import org.apache.geode.redis.RedisIntegrationTest; +import org.apache.geode.redis.internal.netty.Coder; +import org.apache.geode.test.awaitility.GeodeAwaitility; + +public class LolWutIntegrationTest implements RedisIntegrationTest { + private static final int REDIS_CLIENT_TIMEOUT = + Math.toIntExact(GeodeAwaitility.getTimeout().toMillis()); Review comment: This can be removed, and the constant from `RedisClusterStartupRule` with the same name can be used instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
