Skip to content

Commit

Permalink
[CALCITE-5748] Make redis tests passing on windows with guava 32
Browse files Browse the repository at this point in the history
  • Loading branch information
snuyanzin committed Jun 3, 2023
1 parent ed53df1 commit 005ca82
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.net.ServerSocket;
import java.util.logging.Logger;

import redis.embedded.RedisExecProvider;
import redis.embedded.RedisServer;

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.embedded.RedisExecProvider;
import redis.embedded.RedisServer;

import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down
44 changes: 44 additions & 0 deletions redis/src/test/java/redis/embedded/JarUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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 redis.embedded;

import org.apache.commons.io.FileUtils;

import com.google.common.io.Resources;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

/**
* Calcite version of {@link redis.embedded.util.JarUtil}
* allowing to make it work on Windows with Guava 32.0.0+.
*/
public class JarUtil {
private JarUtil() {}
public static File extractExecutableFromJar(String executable) throws IOException {
Path tmpDir = Files.createTempDirectory("redis");

File command = tmpDir.resolve(executable).toFile();
FileUtils.copyURLToFile(Resources.getResource(executable), command);
command.deleteOnExit();
command.setExecutable(true);

return command;
}
}

0 comments on commit 005ca82

Please sign in to comment.